MCPcopy
hub / github.com/angular/angular / createSegmentGroupFromRoute

Function createSegmentGroupFromRoute

packages/router/src/create_url_tree.ts:96–117  ·  view source on GitHub ↗
(route: ActivatedRouteSnapshot)

Source from the content-addressed store, hash-verified

94}
95
96export function createSegmentGroupFromRoute(route: ActivatedRouteSnapshot): UrlSegmentGroup {
97 let targetGroup: UrlSegmentGroup | undefined;
98
99 function createSegmentGroupFromRouteRecursive(
100 currentRoute: ActivatedRouteSnapshot,
101 ): UrlSegmentGroup {
102 const childOutlets: {[outlet: string]: UrlSegmentGroup} = {};
103 for (const childSnapshot of currentRoute.children) {
104 const root = createSegmentGroupFromRouteRecursive(childSnapshot);
105 childOutlets[childSnapshot.outlet] = root;
106 }
107 const segmentGroup = new UrlSegmentGroup(currentRoute.url, childOutlets);
108 if (currentRoute === route) {
109 targetGroup = segmentGroup;
110 }
111 return segmentGroup;
112 }
113 const rootCandidate = createSegmentGroupFromRouteRecursive(route.root);
114 const rootSegmentGroup = createRoot(rootCandidate);
115
116 return targetGroup ?? rootSegmentGroup;
117}
118
119export function createUrlTreeFromSegmentGroup(
120 relativeTo: UrlSegmentGroup,

Callers 2

createUrlTreeMethod · 0.90

Calls 2

createRootFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…