Component Lifecycle
A component has a lifecycle managed by Angular itself. Angular manages creation, rendering, data-bound properties etc. It also offers hooks that allow us to respond to key lifecycle events.
Here is the complete lifecycle hook interface inventory:
ngOnChanges
- called when an input binding value changesngOnInit
- after the firstngOnChanges
ngDoCheck
- after every run of change detectionngAfterContentInit
- after component content initializedngAfterContentChecked
- after every check of component contentngAfterViewInit
- after component's view(s) are initializedngAfterViewChecked
- after every check of a component's view(s)ngOnDestroy
- just before the component is destroyed
Last updated