1.

What are the difference between constructor and ngOnInit in Angular 6?

Answer»
S.noConstructorngOnInit
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.


Discussion

No Comment Found