October 2017
Intermediate to advanced
280 pages
6h 50m
English
In order to trace the order of execution of the callbacks associated with each hook, let's take a peek at the ch5/life-cycle/app.ts example:
// ch5/life-cycle/app.ts@Component({
selector: 'panel',
template: '<ng-content></ng-content>'
})
class Panel {
@Input() title: string;
@Input() caption: string;
ngOnChanges(changes) {...}
ngOnInit() {...}
ngDoCheck() {...}
ngOnDestroy() {...}
ngAfterContentInit() {...}
ngAfterContentChecked() {...}
ngAfterViewInit() {...}
ngAfterViewChecked() {...}
}
The Panel component implements all the hooks without explicitly implementing the interfaces associated with them for the sake of simplicity. Keep in mind that it's considered best practice to implement the interfaces ...
Read now
Unlock full access