Saturday, November 17, 2018

What are Lifecycle Hooks?


An Angular component goes through different stages when it is initialized, changes and destroyed these stages are called lifecycle hooks. These lifecycle hooks helps us interact with the components and its properties through the various stages before it is rendered in the browser, we can make use of these lifecycle hooks to alter the behavior of the component. The constructor is the first method to be executed before any of the lifecycle hook is executed.

At a high level Angular application processing consists of the following 3 stages.



Create stage
    - Create and render root component
    - Create and render child components
Update stage
    - Check for changes in the components data bound properties
Destroy stage
    - Destroy the component

The lifecycle hooks are categorized within these 3 stages of the component. Similar to components Angular Directives also have the same set of lifecycle hooks.


Search Flipkart Products:
Flipkart.com

No comments: