Preloading route strategies
We're already familiar with how to lazy load different feature modules upon navigation. Although sometimes, you might want to preload subsequent routes to make the next route navigation instantaneous or might even want to use a custom preloading strategy based on your application's business logic. In this recipe, you'll learn about the PreloadAllModules
strategy and will also implement a custom strategy to cherry-pick which modules should be preloaded.
Getting ready
The app that we are going to work with resides in start/apps/chapter07/ng-route-preload-strat
inside the cloned repository:
- Open the code repository in your Code Editor.
- Open the terminal, navigate to the code repository directory and run
npm run serve ng-route-preload-strat
to serve the project
This should open the app in a new browser tab. If you log in as an admin, you should see the following: