import { OnDestroy } from "@angular/core" ; import { Observable } from "rxjs/Observable" ; import { Subject } from "rxjs/Subject" ; export abstract class BaseComponent implements OnDestroy { unmount$ : Observable < void > ; private unmountEmitter$ : Subject < void > = new Subject < void > ( ) ; constructor ( ) { this . unmount$ = this . unmountEmitter$ ; } ngOnDestroy ( ) { this . unmountEmitter$ . next ( ) ; this . unmountEmitter$ . complete ( ) ; } }