auto destruction of observable subscription angular code example
Example: clean up an angular subscription
@Component({...})export class AppComponent implements OnInit { subscription: Subscription ngOnInit () { var observable = Rx.Observable.interval(1000); this.subscription = observable.subscribe(x => console.log(x)); }}