Vikas
Difference Between Constructor And ngOnInit In Angular ?
By Vikas in Angular on Dec 20 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