MCPcopy Index your code
hub / github.com/angular/angular / getChildConfig

Method getChildConfig

packages/router/src/recognize.ts:494–531  ·  view source on GitHub ↗
(
    injector: EnvironmentInjector,
    route: Route,
    segments: UrlSegment[],
  )

Source from the content-addressed store, hash-verified

492 return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);
493 }
494 private async getChildConfig(
495 injector: EnvironmentInjector,
496 route: Route,
497 segments: UrlSegment[],
498 ): Promise<LoadedRouterConfig> {
499 if (route.children) {
500 // The children belong to the same module
501 return {routes: route.children, injector};
502 }
503
504 if (route.loadChildren) {
505 // lazy children belong to the loaded module
506 if (route._loadedRoutes !== undefined) {
507 const ngModuleFactory = route._loadedNgModuleFactory;
508 if (ngModuleFactory && !route._loadedInjector) {
509 route._loadedInjector = ngModuleFactory.create(injector).injector;
510 }
511 return {routes: route._loadedRoutes, injector: route._loadedInjector};
512 }
513
514 if (this.abortSignal.aborted) {
515 throw new Error(this.abortSignal.reason);
516 }
517 const shouldLoadResult = await firstValueFrom(
518 runCanLoadGuards(injector, route, segments, this.urlSerializer, this.abortSignal),
519 );
520 if (shouldLoadResult) {
521 const cfg = await this.configLoader.loadChildren(injector, route);
522 route._loadedRoutes = cfg.routes;
523 route._loadedInjector = cfg.injector;
524 route._loadedNgModuleFactory = cfg.factory;
525 return cfg;
526 }
527 throw canLoadFails(route);
528 }
529
530 return {routes: [], injector};
531 }
532}
533
534function sortActivatedRouteSnapshots(nodes: TreeNode<ActivatedRouteSnapshot>[]): void {

Callers 1

Calls 5

firstValueFromFunction · 0.90
runCanLoadGuardsFunction · 0.90
canLoadFailsFunction · 0.90
loadChildrenMethod · 0.80
createMethod · 0.65

Tested by

no test coverage detected