Following are brief of Angular 2 and onward related events/hooks life cycle for basic illustration:
|
Lifecycle
Events/ Hooks
|
Description
|
|
1
|
ngOnChanges
|
Fires before ngOnInit & when dataBound property
changes
|
|
2
|
ngOnInit
|
Fires at on component initialize and after ngOnChanges
|
|
3
|
ngDoCheck
|
Fires at every change detection cycles
|
|
4
|
ngAfterContentInit
|
Fires after inserting content [ngContent]
|
|
5
|
ngAfterContentChecked
|
Fires after every insert content check
|
|
6
|
ngAfterViewInit
|
Fires after initialize of component/nested component
|
|
7
|
ngAfterViewChecked
|
Fires after every check of component/nested
component
|
|
8
|
ngOnDestroy
|
Fires before destroy of component/directive
|