javascript - How to implement promise for http get request? -


i have following http request:-

$http({     method: 'get',     url: 'getdata.php',     params: {bill: 'active'} }) .then(function (response) {     bill=response.data.results; }); 

the request made multiple times , want processing wait until http requests done. want implement promises , return promises @ end of function. how can implement promises around http request?

var arr=[]; arr.push(callhttp()); arr.push(callhttp()); arr.push(callhttp());  promise.all(arr).then(....)   function callhttp(){ return $http({     method: 'get',     url: 'getdata.php',     params: {bill: 'active'} }) } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -