Constructor() Vs ionViewDidLoad()


#1

Upon calling services and getting data setting up the page , is it better to put everything in the constructor() or ionViewDidLoad(), I know viewDidload() won’t get called again if we return to the page that has been rendered is that correct?


#2

If you are lazy loading, put as little in the constructor as possible. That will let your page pop up “immediately” and then get filled in over time. Beyond that, yes, ionViewDidLoad contains things you only want created once per instantiation of the page, while ionViewWillEnter contains things you want done each time the page becomes the active view.


#3

Good explanation. Very helpful.


#4

Many thanks @AaronSterling ! Your reply is so useful.