Below you find the slides as well as the sample I've used at ng-be in Belgium (December 2016) to demonstrate the usage of lazy loading in Angular.
The material shows:
- How to use lazy loading
- How to prevent lazy loading with guards
- How to use preloading
- How to write own preloading strategies
- How to deal with shared modules when lazy loading is used
Btw, because I've been asked: I decided to not split up the AppModule into an AppModule and an CoreModule to keep the sample small.
Downloads:
Further readings:
- Sticky Routes In Angular 2.3+ With RouteReuseStrategy
- Optimizing Performance With Preloading And The New Angular Router
- Angular 2 AOT Compilation And Tree Shaking With Webpack2 And/Or Rollup: Step By Step