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 project that we are going to work with resides in chapter07/start_here/route-preloading-strategies
inside the cloned repository:
- Open the project in Visual Studio Code.
- Open the terminal and run
npm install
to install the dependencies of the project. - Once done, run
ng serve -o
.This should open the app in a new browser tab and you should see something like the following: