Angular Lifecycle

Angular call life cycle hook method when you create/modified/destroy component and directive.
there are eight angular hook methods.

constructor():- Firstly constructor calls when you load the component on DOM, constructor load on the DOM before Angular hook methods.

1) ngOnChanges():- It is called whenever an input value changes. It is called the first time before ngOnInit.

2) ngOnInit():- It is used to initialize data in a component. It is called after input values are set when a component is initialized. It is called once. It is Added to every component by default by the Angular CLI.

3) ngDoCheck():- It is called during every change detection run. it is called immediately after ngOnChanges() and ngOnInit().
ngOnChanges() does not fire when the input property is an array or object. where Angular fails to detect the changes to the input property, the ngDoCheck() allows us to implement our custom change detection.

4) ngAfterContentInit():- It is called only once after first ngDoCheck(). It is called after the first run-through of initializing content. It calls after Angular projects external content into the component.

5) ngAfterContentChecked():- It is called after every ngDoCheck(). It waits till after ngAfterContentInit() on first run through.

6) ngAfterViewInit():- It is called after Angular initializes component and child component content. It is called only once after view is initialized.

7) ngAfterViewChecked():- It is called after all the content is initialized and checked.

8) ngOnDestroy():- It is called only once just before the component is removed from the DOM.