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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -