DEV Community

Discussion on: The Ultimate Answer To The Very Common Angular Question: subscribe() vs | async Pipe

 
tomastrajan profile image
Tomas Trajan 🇨🇭 • Edited
ngOnInit() {
   this.source$.pipe(takeUntil(onDestroy$)).subscribe()
}

ngOnDestroy() {
    this.onDestroy$.next(true);
    this.onDestroy$.complete()
}

CHeers!