Lazy loading is the beautiful feature which Angular provides. We can load the modules only when the user navigates to their routes for the
first time. It will increase the application performance and also will reduce the initial bundle size.
The Angular Router has always supported lazy loading but now in Angular 8, we can dynamically import the lazy-loaded module only when it is needed.
It is promise based and gives you access to the module whenever the module is called.
Let's create a transaction module for demonstrating the angular 8 dynamic EcmaScript imports:
1
2
3
|
ng g c transactions/list
ng g c transactions/detail
ng g c transactions/create
|
This will create a transaction list, detail and create components. ...