133
rated 0 times
[
140]
[
7]
/ answers: 1 / hits: 23156
/ 11 Years ago, fri, october 25, 2013, 12:00:00
I'm getting data from an async service inside my controller like this:
myApp.controller('myController', ['$scope', 'AsyncService',
function($scope, AsyncService) {
$scope.getData = function(query) {
return AsyncService.query(query).then(function(response) {
// Got success response, return promise
return response;
}, function(reason) {
// Got error, query again in one second
// ???
});
}
}]);
My questions:
- How to query the service again when I get error from service without returning the promise.
- Would it be better to do this in my service?
Thanks!
More From » angularjs