Lazy-loading with Angular 7
Lazy Loading in Angular with Compodoc Visualization
Have you ever found yourself in position where reading an entire technical article and all of a sudden realizing that you have no idea what you just read and how to implement that ? Then trust me you are on a right page.
Let visualize first
“Lazy Loading Feature Modules”, a feature that can help you a lot with large and complex applications. By lazy-loading a module we can tell Angular to load it only when its route is been visited, meaning that its weight won’t affect the size of your application at initialization. In other words angular provides easy way to divide application bundle into chunks based on group of features or routes and reduce initial load time. Feature modules are basically “NgModules” are used for the purpose of organizing code in our project.
In more simple word Lazy loading is a technique to restrict all angular modules to load at once during run time but lazy loaded modules are loaded on demand.
Official documentation repository has moved to https://compodoc.github.io/website/
For the final sample application with two lazy loaded modules that this page describes can be download from official angular examples , see the live example / download example and for more deep understanding follow the link given below:
Happy Lazy Loading :)