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