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();         });     });  }); 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo