Skip to content

Angular Lifecycle Hook

Md. Shohel Rana edited this page May 6, 2018 · 3 revisions

Every framework has a lifecycle, Here is the lifecycle managed by Angular. Angular creates it, renders it, creates and renders its children, checks it when its data-bound properties change, and destroys it before removing it from the DOM.

Component lifecycle

constructor(myService: MyService, ...) { ... } ngOnChanges(changeRecord) { ... } ngOnInit() { ... } ngDoCheck() { ... } ngAfterContentInit() { ... } ngAfterContentChecked() { ... } ngAfterViewInit() { ... } ngAfterViewChecked() { ... } ngOnDestroy() { ... }

Directive lifecycle

Clone this wiki locally