What are the lifecycle hooks event in Angular?

What are the lifecycle hooks event in Angular?

When the angular application runs, it goes through a different life cycle. Following are the life cycle hooks that angular goes through
  • ngOnInit
After the first ngOnChanges.
  • ngDoCheck
When the change detection is performed, ngDoCheck() is called to perform your custom change detection.
  • ngOnDestroy
Just before the directive is destroyed.
  • Constructor
The Constructor is a default method of the class that is executed when the class is instantiated and ensures proper initialisation of fields in the class and its subclasses while ngOnInit is angular life cycle hook method.
  • ngOnChanges.
When component input/output binding value chages
  • ngAfterContentInit (only for components)
After component content initialized.
  • ngAfterContentChecked (only for components)
After every check of component content.
  • ngAfterViewInit (only for components)
After a component’s views are initialized.
  • ngAfterViewChecked (only for components)
After every check of a component’s views.

Please do not post any spam link in the comment box😊

Post a Comment (0)
Previous Post Next Post