@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