AngularJS $q.all for all queries in controller
i have multiple queries in contoller, that loading then contoller is
loading (and after click on some elements)
var d = $q.defer();
$scope.userOrders = UserOrders.query({id:$routeParams.id},
function(result) {
d.resolve(result);
});
$q.all([d.promise]).then(function(response){
$('#loading').hide();
});
How i can write this only once, not in each controller?
No comments:
Post a Comment