Each Angular component goes through 8 phases in its lifecycle. When it is initialized, it creates and presents its root components. For the components that get loaded during application development, it keeps checking when the data binding properties are getting changed and updated. When the component is not used anymore, it approaches the death phase and is decimated and expelled from the DOM
This is invoked when Angular creates a component or directive by calling new on the class
Invoked every time there is a change in one of th input properties of the component
Invoked when given component has been initialized, This hook is only called once after the first ngOnChanges
Invoked when the change detector of the given component is invoked. It allows us to implement our own change detection algorithm for the given component
ngOnDestroy: This method will be invoked just before Angular destroys the component.Use this hook to unsubscribe observables and detach event handlers to avoid memory leaks
Invoked after Angular performs any content projection into the component view
Invoked each time the content of the given component has been checked by the change detection mechanism of Angular
Invoked when the component view has been fully initialized
Invoked each time the view of the given component has been checked by the change detection mechanism of Angular
These hooks are only called for components and not directives.