What is lazy loading, and how do you do it with routes?

Angular routing · Freshers and experienced

Model answer

Lazy loading means a part of the app is downloaded only when the user first needs it. Use loadComponent: () => import('./admin').then(m => m.AdminPage) for a single standalone component, or loadChildren for a group of routes.

The benefit is a smaller first bundle and faster start. Keep the home and main screens in the initial bundle, and lazy load rarely used areas such as admin screens or reports.

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions