Reputation: 419
I hope the title is quite self explanatory. Nativescript now supports AOT and lazy loading, but I am struggling to achieve preloading on top of the example at https://github.com/nativescript/nativescript-sdk-examples-ng. If you run the example provided, you will notice that 1s lag between switching pages (loading different modules).
Is this possible with Nativescript 2.5?
Upvotes: 1
Views: 1147
Reputation: 11
Yes it is possible, at least in NS 3.0. I asked this in nativescript forums: https://discourse.nativescript.org/t/is-it-possible-to-preload-lazy-loaded-modules/1363
It's very easy, you just have to use directly the Angular Router feature:
NativeScriptRouterModule.forRoot(ROUTES,
{preloadingStrategy: PreloadAllModules} // import { PreloadAllModules } from "@angular/router";
)
Upvotes: 1