I can't speak for the OP, but we abstracted the inner workings of the
$resource away by putting them into a service and wrapping every resource
call in $q. Something like this:
function doSomething(){
var defObj = $q.defer();
var Promise = myResource.query();
Promise.$promise.then(function(data){
defObj.resolve(data);
});
return defObj.promise;
}
The end call in the controller (directive, filter, other service) just has
to deal with a promise to resolve.
var serviceResult = myService.getSomething();
serviceResult.then(function(data){
myVar = data;
});
It may not be what you are looking for, but it works for us.
--
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.