javascript - Put an order to the result of $http requests in Angular.js -
i have 3 web requests through $http, petition in functions (function1()
, function2()
, function3()
) . customize order in these requests executed.
object.function1().then(function() { //result of petition $http of function1(); }); object.function2().then(function() { //result of petition $http of function1(); }); object.function3().then(function() { //result of petition $http of function2(); });
they try run @ same time. requests take longer others because more json objects. want run in order start by:
function1(); //first function2(); //second function3(); //three
call functions inside other function's callback this:
object.function1().then(function() { //result of petition $http of function1(); object.function2().then(function() { //result of petition $http of function1(); object.function3().then(function() { //result of petition $http of function2(); }); }); });