Using async/await is perfect for your situation. It will help you to make your code more readable and make abstraction of the async part thanks to the await keyword
aync post(){
const res1 = await this._service1.save(this.data1).toPromise();
const res2 = await this._service2.save(res1).toPromise();
console.log('here is my data 2 ' + res2);
return 'what you want, can be res1 or res2 or a string';
}
How to call it ?
this.myService.post().then( (whatYouWanted) => {
console.log(whatYouWanted); // what you want, can be res1 or res2 or a string
});
0
solved angular 6 wait post response