Is it possible to preload lazy loaded modules?


We have a project with AoT, lazy-loading and NS 3.0. We are now trying to improve the performance.We are having UI delays when we load the ‘lazy-module’ for the first time.

Is there a way to preload the lazy-modules while user is navigating a page? We’d like to remove these moments in which the App seems to be frozen.

Related SO question:


Yes, in app.module.ts you can add this to @NgModule's imports to preload all modules in the background:

        {preloadingStrategy: PreloadAllModules} // import { PreloadAllModules } from "@angular/router";


It works! Thank you very much