Wednesday, January 25, 2017

Angular 2 life cycle


  • A component has a life cycle event managed by angular
  • Angular creates it, renders it, creates and renders its children, checks when its databound  properties change, and destroys it before removing it from the DOM
Sample code :Plnkr

Life cycle hooks

Angular offers life cycle hooks that provide visibility into these key life moments and the ability to act when they occur

Simple example of using onInit event

To use life cycle hooks we implement angular interface

<

No comments:

Post a Comment