I have an array and I do for loop on the array. for eeach item - i do rest call and save it in the array restArr;
angular.foreach(myItems , function(item){
var q = $http.get("someHttpCall").succsee(function(){}).error(function(){});
restArr.push(q);
}
then i use $q
$q.all(restArr).then(function(){
doSomething();
});
Firstly, what happend if one of the call returned with error? And second - there is a way to start again call that return with error?
thanks
If one of the promises within a $q.all
is rejected, the overall promise is rejected. The rejection value is the same as that from the one rejected promise.
Catch the rejection, then handle your retry logic in the catch handler.
$q.all(restArr)
.then(doSomething)
.catch(handleError);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.