(route: ActivatedRouteSnapshot)
| 94 | } |
| 95 | |
| 96 | export 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 | |
| 119 | export function createUrlTreeFromSegmentGroup( |
| 120 | relativeTo: UrlSegmentGroup, |
no test coverage detected
searching dependent graphs…