I want multiple methods to get loaded completely before I proceed in my web application. For that I have done following -
function getData(){
var defer = $q.defer();
$http.get("/echo/json/").success(function(data, status) {
getData2();
getData3();
$timeout(function(){
defer.resolve(data);
}, 1000);
});
return defer.promise;
}
here, getData2() and getData3() will also do ajax calls. So I have to wait these methods to complete there call and then I have to return promise of main method.
This is working good , but giving me performance issue. Any other way I can do this?