ionViewDidLoad vs construct

What is the difference between ionViewDidLoad and costruct?

Your constructor is typically called when a class is initialized, ionViewDidLoad() is an Ionic lifecycle event that get’s fired every time the view is loaded in your app. IonViewDidLoad can only be attached to components who are Ionic Pages.

Example:

open the page for the first time, your constructor will be called. ionViewDidLoad() will fire when the view is ready.

Every time the same page is opened, the ionViewDidLoad() will fire when the page is done loading. The constructor won’t fire the second time though, it already did the first time the class was initiated.

1 Like