It requires the use of $q:
var defObj = $q.defer();
var customerListRequest = Customer.query({limit:limits, offset:offset});
customerListRequest.$promise.then(function(data){
//success
defObj.resolve(data);
), function(data){
//error
defObj.reject(data);
});
return defObj.promise;
Put this (or something like it) inside of your service for each method you
return. You can also write an HTTP Interceptor (see an example
here:
http://stackoverflow.com/questions/18737674/handle-http-302-response-from-proxy-in-angularjs/20864014#20864014)
to handle all of your error responses, thus saving you a lot of code in
your services.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.