Component Lifecycle Hooks
In this lesson, we will look at the different life cycle hooks available to a component and the function of those hooks at each stage.
We'll cover the following...
A component grows and goes through multiple phases throughout its life. Using and controlling these phases using lifecycle hooks helps you get a better hold of your application.
The component gets created, renders, renders its children, makes changes and gets destroyed. And this lifecycle is split into multiple phases that are linked to the component or the children of the component.
Constructor
A constructor
is invoked when Angular creates a component using the new
keyword in the class.
ngOnInit
This is invoked when the component initializes and gets the data.
ngOnchanges
This ...