Monday, April 23, 2018

Angular - Component Life Cycle Hooks

Common Lifecycle Hooks

OnInit

Perform component initialization and retrieve data

import { Component, OnInit } from '@angular/core';
export class MyComponent implements OnInit {
    ngOnInit(): void {
        console.log('In OnInit');
    }
}

OnChanges

Perform action after change to input properties

OnDestroy

Perform cleanup for the component


1 comment:

Kalai chellam said...

Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....

OFFERS IN CHENNAI