With lazy loaded modules in Angular, it’s easy to have features loaded only when the user navigates to their routes for the first time. This can be a huge help for your app’s performance and reducing the initial bundle size. Plus, it’s pretty straight-forward to setup!
The following covers lazy loading modules in Angular 2+ apps.
Lazy loaded routes need to be outside of the root app module, so you’ll want to have your lazy loaded features into feature modules.
Assuming that you have an Angular CLI project, let’s create a new feature module:
$ ng g module shop
Now let’s also create 3 components inside our
... read the whole story at alligator.io.