0
我覺得自己很笨,但我不覺得有什麼問題在這裏將元素添加到陣列中的嵌套範圍
var images = [];
angular.forEach($scope.flow.images.files, function (flowFile, i) {
var fileReader = new FileReader();
fileReader.onload = function (event) {
var uri = event.target.result;
images.push(uri);
console.log(images.length); // First iteration length = 1, second iteration length = 2
};
console.log(images.length); // Always shows 0
fileReader.readAsDataURL(flowFile.file);
});
誰能幫我明白了嗎?