So I have a couple of linked promises and when I log the resolution of the promise I get an object/array that looks like (In red):
However, when I try to access the elements in the array through a for-loop I get an undefined (in blue). The code that tries to iterate through the array looks like:
var defer = $q.defer();
defer.promise
.then(function() {
$scope.addProperties();
}).then(function() {
$scope.getPictures().then(function(result) {
console.log(result);
for(var i = 0; i < $scope.poll.options.length; i++) {
console.log(result[i]);
$scope.poll.options[i].imageURL = result[i];
}
console.log($scope.poll);
});
});
defer.resolve();
But to see more of the code please refer to: this gist
How would I be able to access the elements in this array, since the "normal" method doesn't seem to work?
via daman
No comments:
Post a Comment