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
Post a Comment