A component instance has a life cycle which starts from component class initialization and component view rendering and component child view rendering.It goes on with change detection,as angular checks if the data bound properties are changed or not.The life cycle ends when a component is destroyed.
Lifecycle Hooks
We can act on the component during a lifestyle change if we wish using the following life cycle hooks namely:-
- ngOnChanges—>called when data bound property changes
- ngOnInit—>called on initialization of components
- ngDoCheck—>called when some changes occur
- ngAfterViewInit—>called when angular ‘s component’s view n child view completely rendered
- ngAfterContentChecked
- ngOnDestroy—>called when angular destroys the component
Comments
Post a Comment