Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

What is the equivalent of "resolve" in ionic 2?

$
0
0

@icarus_31 try using async.waterfall(). I'd expect @luchillo17 's approach to call all the then() functions at the same time.

See: http://spion.github.io/promise-nuggets/12-doing-things-in-series.html

Otherwise you can implement something like this:

var datafunctions= [serviceA.getData, serviceB.getData, serviceC.getData];
function getNext() {
   var func = datafunctions.pop();
   func().then(function () {
      if (datafunctions.length > 0) getNext();
   });
}
getNext();

You're probably better off with waterfall as this ignores errors.
If you can do the services parallel you could try Promise.all(datafunctions).then(function () { console.log("all done"); });


Viewing all articles
Browse latest Browse all 228595

Trending Articles