What's the best way to call a subscription wait for result to start another subscription? Something similar to await in javascript, I need the result of the first call to start the next call. I have this:
this.apiService.getAllData()
.subscribe(
( response: any ) => {
this.allData = response['data'];
this.allData.forEach(function (id) {
this.apiService.getDataDetail(id)
.subscribe((detail: any) => {
console.log('detail: ', detail);
});
});
},
err => {
console.log('Something wrong...');
}
);
My problem is, the call subscription inside the first subscription do not recognize the service . This warning show me by my editor
Potentially invalid reference access to a class field via 'this.' of a nested function