Lazy-Loading Routes
Discover how to use lazy loading in Angular applications to efficiently load feature modules only on demand. This lesson guides you through creating lazy-loaded modules, setting up routes with dynamic imports, and understanding the impact on app performance and service instances.
We'll cover the following...
At some point, our application may grow in size, and the amount of data we put into it may also grow. The result is that the application may take a long time to start initially, or certain parts can take a long time to start. To overcome these problems, we can use a technique called lazy loading.
Lazy loading means that we don’t load all parts of our application initially. When we refer to parts, we mean Angular modules. Application modules can be separated into chunks that are only loaded when needed. There are many advantages of lazy loading a module in an Angular application:
Feature modules can be loaded upon request from the user.
Users that visit certain areas of our application can ...