Loading…

Explain the difference between constructor and ngOnInit in Angular 6?

S.no Constructor ngOnInit
1. The Constructor is a default method of the class executed when the class is instantiated and makes sure proper field initialization in the classes and subclasses. In Angular 6, ngOnInit is a life cycle hook used to by the program to indicate that the component is successfully created by the Angular.

Suggest An Answer

No suggestions avaliable!

Latest post from Angular 6 Interview Questions

Ask Question