I have a function where I make multiple $http.get calls. I want the function to wait until all the calls are complete. Below is the scenario
myApp.run(['$httpBackend','$http',function($httpBackend, $http){
$http.get('data1.json').then(function(data){
//do something
});
$http.get('data2.json').then(function(data){
//do something
});
$http.get('data3.json').then(function(data){
//do something
});
//return the function only after all three .then functions are compelte
}]);
I am using promise, however I am not sure I am using it in a right way. Right now the function .run() returns even before the $http.get().then() calls are complete.