Difference between Constructor and ngOnInit in Angular.

added by JavaScript Kicks
12/28/2019 6:30:07 PM

1273 Views

Learn Angular-In-Depth | Learn TypeScript-In-Depth. The Constructor is a default method of the class that is executed when the class is instantiated. Constructor ensures proper initialization of fields (class members) in the class and its subclasses. Angular Dependency Injector (DI) analyse the constructor parameters.


0 comments