HTTP request chains can be reached using the Observable.flatMap
statement. Suppose we want to make three queries, each of which depends on the result of the previous one:
this.service.firstMethod() .flatMap(firstMethodResult => this.service.secondMethod(firstMethodResult)) .flatMap(secondMethodResult => this.service.thirdMethod(secondMethodResult)) .subscribe(thirdMethodResult => { console.log(thirdMethodResult); });
This way you can link as many interdependent queries that you want.
source share