Lazy Loading Routes for Faster Angular Apps
Load feature pages only when needed to improve performance, especially for big websites.
Lazy loading means you do not ship the whole app upfront. You load a feature only when the user visits it. ## Example: Lazy-load a component route ```ts { path: 'admin', loadComponent: () => import('./admin/admin.component').then(m => m.AdminComponent) } ``` ## Why it helps - smaller initial bundle - faster first load - better performance on mobile networks ## Visual: eager vs lazy ```mermaid flowchart LR A[App Load] --> B1[Eager: Load Everything] A --> B2[Lazy: Load Home Only] B2 --> C[User Visits /admin] C --> D[Load Admin Feature] ``` > Next: HTTP requests, calling APIs with HttpClient.