How make couple http calls before changing page

Here my situation.

Right now, before pushing another page, I am doing 3x http calls done by 3 different services. They all return promises then, I push the next page

One service looks like

return new Promise((resolve, reject) => {
        .map(res => res.json())
          data => {
            this._itemsList = data.itemsList;
          error => {
            console.log("Error to get items list");
            reject("Error to get items list");

In the .ts file that calls all the http looks like

  .then((success) => { return this._gService.retrieveGData(); })
  .then((success) => { return this._cService.retrieveCData(); })
  .then((success) => this._nav.push(DashboardPage));

I know the http request returns an Observable, but I don’t know much about it and don’t know if it is possible to call all those http and then call the nav.push. If so, how do you do that?


If I were you, I’d really look deeper into the rxjs library that angular 2 uses. It’s much more powerful than Promises, and has a couple of options for doing exactly what you’re looking for. However, the answer to your question by using es6 Promise’s is the .all method.

Hi @jpmckearin,

Thanks for the links. I like the idea of forkJoin. I have a concern though and would like to share with you.

Have you worked a bit with RxJS library to be able to help me?