RouterModule.forRoot(routes,
{ preloadingStrategy: PreloadAllModules })
Angular's official documentation provides this preloading strategy to preload all modules. However, I don't want all of the several modules load up. I want sub-directories to preload after opening parent directory. Also, preload other possible modules which can be called from current active route. I don't want all modules to preload at start. How do I do that?
You can introduce a data property with all routes to decide which modules to preload and which to not and implement PreloadAllModule and change implementation depending on this data flag.
Refer to :- https://coryrylan.com/blog/custom-preloading-and-lazy-loading-strategies-with-angular
You can have custom preloading via having some custom code in Appcomponent, not via Preload strategy. For doing so refer to :-