I have an abstract Base Component that cleans subscriptions with oneself:
import { OnDestroy, OnInit } from '@angular/core';
import { Subject } from 'rxjs/Subject';
export abstract class NeatComponent implements OnDestroy, OnInit {
// Add '.takeUntil(this.ngUnsubscribe)' before every '.subscrybe(...)'
// and this subscriptions will be cleaned up on component destroy.
protected ngUnsubscribe: Subject<any> = new Subject();
public ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
}
public ngOnInit(){}
}
Now I creating working component:
export class CategorySelectorComponent extends NeatComponent {
public constructor() { super(); }
public ngOnInit() {
// some code
}
}
All works fine, but tsLint not likes my ngOnInit method:
[tslint] Implement lifecycle hook interface OnInit for method ngOnInit in class CategorySelectorComponent (use-life-cycle-interface)