How do you lazy load modules in Angular?
- Lazy loading delays loading feature modules until the user navigates to their route.
- Implemented with the router using loadChildren and dynamic imports.
Example:
const routes: Routes = [
{
path: 'admin',
loadChildren: () => import('./admin/admin.module').then(m =>
m.AdminModule)
}
];
This reduces initial bundle size and improves app startup time.