(
injector: EnvironmentInjector,
route: Route,
segments: UrlSegment[],
)
| 518 | return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []); |
| 519 | } |
| 520 | private async getChildConfig( |
| 521 | injector: EnvironmentInjector, |
| 522 | route: Route, |
| 523 | segments: UrlSegment[], |
| 524 | ): Promise<LoadedRouterConfig> { |
| 525 | if (route.children) { |
| 526 | // The children belong to the same module |
| 527 | return {routes: route.children, injector}; |
| 528 | } |
| 529 | |
| 530 | if (route.loadChildren) { |
| 531 | // lazy children belong to the loaded module |
| 532 | if (route._loadedRoutes !== undefined) { |
| 533 | const ngModuleFactory = route._loadedNgModuleFactory; |
| 534 | if (ngModuleFactory && !route._loadedInjector) { |
| 535 | route._loadedInjector = ngModuleFactory.create(injector).injector; |
| 536 | } |
| 537 | return {routes: route._loadedRoutes, injector: route._loadedInjector}; |
| 538 | } |
| 539 | |
| 540 | if (this.abortSignal.aborted) { |
| 541 | throw new Error(this.abortSignal.reason); |
| 542 | } |
| 543 | const shouldLoadResult = await firstValueFrom( |
| 544 | runCanLoadGuards(injector, route, segments, this.urlSerializer, this.abortSignal), |
| 545 | ); |
| 546 | if (shouldLoadResult) { |
| 547 | const cfg = await this.configLoader.loadChildren(injector, route); |
| 548 | route._loadedRoutes = cfg.routes; |
| 549 | route._loadedInjector = cfg.injector; |
| 550 | route._loadedNgModuleFactory = cfg.factory; |
| 551 | return cfg; |
| 552 | } |
| 553 | throw canLoadFails(route); |
| 554 | } |
| 555 | |
| 556 | return {routes: [], injector}; |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | function sortActivatedRouteSnapshots(nodes: TreeNode<ActivatedRouteSnapshot>[]): void { |
no test coverage detected