Lazy loading means the module is only downloaded and initialized when the user navigates to its route for the first time. This improves startup performance.
Option A uses the recommended dynamic import syntax returning a promise that resolves to the module class.
Option A is the deprecated string syntax.
Option A incorrectly uses a module as a component.
Option A returns the module directly without import.
{ path: 'admin', loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule) }But navigating to '/admin' shows a 404 error in the browser console. What is the most likely cause?
When refreshing or directly accessing a lazy-loaded route, the server must serve index.html for all routes. Otherwise, the server returns 404 because it doesn't know about Angular routes.
Angular loads and initializes a lazy-loaded module once per app session. Later navigations reuse the already loaded module instance.
Lazy loading delays loading feature modules until needed, reducing initial load time and improving perceived performance.