Andrew Scott
4962a4a332
feat(router): Allow loadChildren to return a Route array ( #45700 )
...
This commit expands the `LoadChildrenCallback` to accept returning `Routes`
in addition to the existing `NgModule` type. In addition, it adds a
check to ensure these loaded routes all use standalone components.
The components must be standalone because if they were not,
we would not have the required `NgModule` which the component is declared in.
Existing API:
```
{path: 'lazy/route', loadChildren: import('./lazy').then(m => m.LazyModule)}
@NgModule({
imports: [
ExtraCmpModule,
RouterModule.forChild([
{path: 'extra/route', component: ExtraCmp},
]),
],
})
export class LazyModule {}
```
The new API for lazy loading route configs with standalone components
(no NgModule) is to expand `loadChildren` to allow returning simply a `Routes` array.
```
// parent.ts
{
path: 'parent',
loadChildren: () => import('./children').then(m => m.ROUTES),
}
// children.ts
export const ROUTES: Route[] = [
{path: 'child', component: ChildCmp},
];
```
Note that this includes minimal documentation updates. We need to
include a holistic update to the documentation for standalone components
in the future that includes this feature.
PR Close #45700
2022-04-22 09:25:20 -07:00
..
2022-04-20 15:14:01 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-20 15:14:01 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-19 09:26:12 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2021-09-14 08:32:51 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-20 12:57:37 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-19 09:14:36 -07:00
2022-04-11 17:41:59 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2021-10-12 21:38:37 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-19 09:17:33 -07:00
2022-04-08 19:36:30 +00:00
2022-04-19 09:17:33 -07:00
2021-10-29 15:46:32 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-12 21:29:06 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-20 15:14:01 -07:00
2022-04-22 09:25:20 -07:00
2022-04-20 15:14:01 -07:00
2022-04-18 14:10:16 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-19 20:20:39 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-12 23:55:32 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-11 17:41:59 +00:00
2022-04-11 17:41:59 +00:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-14 15:00:04 -07:00
2022-04-08 19:36:30 +00:00
2022-04-08 19:36:30 +00:00
2022-04-12 18:40:08 +00:00
2022-04-08 19:36:30 +00:00