I have the following angular service:
app.factory('myFactory', function ($http) {
var returnedObject = {
getA: function() { return $http.get('../A'); },
getB: function() { return $http.get('../B'); },
getC: function() { return $http.get('../C'); },
};
return returnedObject;
});
app.controller('MyService', MyController);
I want to execute a function when all services complete like so:
$q.all([
returnedObject.getA().success,
returnedObject.getB.success,
returnedObject.getC.success,
]).then(function () {
console.log("promise kept");
});
I'm just not sure where I can find $q. I'm confused by all the indirection. I'm looking to basically do what was suggested in this question.