All you have to do is use forkJoin , it will call both of your first asynchronous calls and only return data upon completion, so no need to worry
After that, on the subscription, you will get the result in an array of the sequence that you called urls or apis.
const combined = Observable.forkJoin( this.areasService.getSelectAreas({}).map((res) => res.json().data.areas), this.stationsService.getSelectStations({}).map((res) => res.json().data.stations) ) combined.subscribe(latestValues => { this.areasSelect = latestValues[0]; this.stationsSelect = latestValues[1]; this.transportsService.getTransport().subscribe((res) => { console.log(this.areasSelect) console.log(this.stationsSelect) }) });
source share