I am trying to handle errors with my resources and then handle the rejection of resources in $q.all() .
This is my code:
var user = User.get({id: 1}, function() { // Success }, function(response) { // Error return $q.reject(response); }); var promiseList = [user]; $q.all(promiseList).then(function(){ // Success <-- this seems to run all the time }, function(response) { // Error <-- this never seems to run but I want it to });
When my user resource gets 404, an error callback processes it and returns $q.reject .
However, the success call in my $q.all is $q.all called, not my error . I would think because I reject my promise that the $q.all error $q.all will be triggered?
I appreciate that I have only 1 element in my promiseList , but should this not change if it is?
javascript angularjs promise q
Greg Feb 07 '14 at 11:11 2014-02-07 11:11
source share