import { OnDestroy } from '@angular/core'; import { Subject } from 'rxjs'; export abstract class BaseComponent implements OnDestroy { protected _destroyed: Subject = new Subject(); protected constructor() { } ngOnDestroy(): void { this._destroyed.next(true); this._destroyed.complete(); } }