I have two api and I want when both of api is complet,do another work, And the other question is that if I want to act as a chain, one should run first and then run the latter,in console is undefine write
var promiseA = service.getAppReciverServiceList(function (data) {
self.chargeMoney = data;
});
var promiseB = service.getAppReciverServiceList(function (data) {
self.chargeMoney = data;
return data;
});
setTimeout(function () { console.log(promiseB); }, 2000);
q.all([
promiseA, promiseB
]).then(function (data) {
console.log(data)
//Array of result [resultOfgetServiceDetails1, resultOfgetServiceDetails2]
scope.variable = data;
});