Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

How make couple http calls before changing page

$
0
0

@icarus_31 wrote:

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) => {
      this._http.get(url)
        .map(res => res.json())
        .subscribe(
          data => {
            this._itemsList = data.itemsList;
            resolve(this._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

this._itemService.retrieveItemsData()
  .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?

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>