[SOLVED]Preload components in background after app start


#1

I am using lazy loading with ionicpage decorator for my app. Some of the pages which use lot of input elements take some time to show when i click the button for the first time. Repeat clicks show the pages quite fast as they were already loaded at least once.

The benifit of lazy loading is that the initial time to start the app is very less and this is beneficial for large apps particularly.

Is there anyway i can load the views in the background so that when i click the button, it does not take the time to show at first? The reason i ask this is that the delay is noticeable.


#2

Interesting idea, never seen it used or talked about here. Hope someone knows more.


#3

As described in the docs you just need to set preloadModules to true in your application config:

IonicModule.forRoot(MyApp, {
  preloadModules: true
})

#4

Awesome, have not tried it yet but will this increase the first startup time of the app?


#5

It shouldn’t as

Preloading eagerly loads all deep links after the application boots instead of on demand as needed.


#6

I preload about 20 pages and the first few seconds the app lags a bit…


#7

This works great. Thanks guys.


#8

Anything similar for the tabs ?


#9

Oh My Precious. This literary saved my back.
THANK YOU