angularjs - Fetching Data From Two Or More Api Synchronously -


i'm using angularjs in project:

var getapi = function(){      $http.get(link)     .then(function(response) {$scope.data = response.data.api});    } 

but time, have fetch link 2 or more links. how can this? have fetch data 5 api synchronously , sum of data.

you can this:

var getapi = function(){     $q.all([          $http.get(link),          $http.get(link),          $http.get(link),          $http.get(link),          $http.get(link)     ]).then(function(resultarray) {         // resultarray contain 5 objects responses       }); } 

more info $q.all here.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -