Cancel flatMap observable call chain
问题 I am using angular 5 and rxjs. I am making 2 service calls, one dependent on others results. I am doing it using flatMap. I am also using takeUntil so that I can abort operation at any given point. My code looks like below: this.myservice.api1(param1).pipe(takeUntil(this.destroyed$), finalize(() => { //do something after both api calls are completed }, flatMap((result1) => { //do some operation and create object x(this.objx) return this.myservice.api2(param1); }) ).subscribe((result2) => { /