Angular
Fundamentals of Angular - Feature Modules

Lazy Loading a Feature Module

Outline

In this video...

You will learn how to lazy load a feature module.

Lazy loading a module means that it isn't in the initial download of an application, which means that the application can respond much faster initially. This greatly increases percieved performance of a web app.

This is primarily done by removing all direct references to the feature module and its pieces in the root module. Usually this mean removing imports in the app module, and anything in the root routing config.

Then you create a special route to the feature module, using the loadChildren key, like so:

{ path: 'actors', loadChildren: () => import('./actors/actors.module').then(m => m.ActorsModule) }

 

I finished! On to the next chapter