A brief discussion about Angular lifecycle hooks.

Today In this blog, we are going to discuss about the life cycle hooks of the angular components.

A brief discussion about Angular lifecycle hooks.expoundsofttechsolution Install node js on Go Daddy Shared hosting.

Every component has a lifecycle in angular. The Angular creates/generates and renders these components and also destroys them before removing them from the DOM. And this process has happened with the help of lifecycle hooks.

Following are the list of angular life cycle hooks :

  • ngOnChanges() – Responds when Angular sets/resets data-bound input properties.
  • ngOnInit() – Initialize the directive/component after Angular first displays the data-bound properties and sets the directive/component’s input properties.
  • ngDoCheck() – Detect and act upon changes that Angular can’t or won’t detect on its own.
  • ngAfterContentInit() – Responds after Angular projects external content into the component’s view.
  • ngAfterContentChecked() – Respond after Angular checks the content projected into the component.
  • ngAfterViewInit() – Respond after Angular initializes the component’s views and child views.
  • ngAfterViewChecked() – Respond after Angular checks the component’s views and child views.
  • ngOnDestroy – Cleanup just before Angular destroys the directive/component.

So, thanks for following this blog, and if you need any help please leave your queries in the comment box we will be happy to help you.

A brief discussion about Angular lifecycle hooks.expoundsofttechsolution Install node js on Go Daddy Shared hosting.