What is the difference between constructor and ngOnInit?
|This one is a default class method which gets called when we create new objects.||It's an Angular managed life cycle hook to indicate the completion of the component.|
|A constructor is mostly used to inject dependencies.||We use this to perform initialization logic even if the logic doesn't depend on DOM, DI and input bindings.|
Suggest An Answer
No suggestions Available!