Чистый способ отписаться от всех наблюдаемых в компоненте:
//declare
private ngUnsubscribe: Subject<any> = new Subject<any>();
//add takeUntill where subscribing to observables
this.myService.serviceFunction()
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(
res => {
// use res
},
err => {}
);
//unsubscribe all
ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
}