Gajendra Jangid
what is the difference between "Constructor" and "ngOnInit"?
By Gajendra Jangid in Angular on Feb 11 2019
  • Kiran Mohanty
    Sep, 2020 2

    Constructor fires as soon as your application runs, as we register all components under module. But ngOnInit fires only when application loads that particular component.If you have to do any API call, it’s advisable to define inside ngOnInit. We can do component property initialization inside constructor.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS