Unsubscribe multiple api subscribe in angular 14

Viewed 27

I'm trying to unsubscribe but it's not working where I'm having one api response inside making another api call.

 this.sub = this.dataSevice.gerApp("true").pipe(switchMap(res)=> return this.dataService.getAppTwo("empty")). subscribe((res)=>console.log(res));

ngOnDestroy(){
this.sub.unsubscribe();
}
1 Answers

HTTPClient will emit only once. HTTPClient is a finite observable, so it is self completed. No need to worry about unsubscribe.

Related