MCPcopy
hub / github.com/angular/angular / recognize

Method recognize

packages/router/src/recognize.ts:97–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 async recognize(): Promise<{state: RouterStateSnapshot; tree: UrlTree}> {
98 const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
99
100 const {children, rootSnapshot} = await this.match(rootSegmentGroup);
101 const rootNode = new TreeNode(rootSnapshot, children);
102 const routeState = new RouterStateSnapshot('', rootNode);
103 const tree = createUrlTreeFromSnapshot(
104 rootSnapshot,
105 [],
106 this.urlTree.queryParams,
107 this.urlTree.fragment,
108 );
109 // Creating the tree stringifies the query params
110 // We don't want to do this here to preserve pre-existing behavior
111 // so reassign them to the original.
112 tree.queryParams = this.urlTree.queryParams;
113 routeState.url = this.urlSerializer.serialize(tree);
114 return {state: routeState, tree};
115 }
116
117 private async match(rootSegmentGroup: UrlSegmentGroup): Promise<{
118 children: TreeNode<ActivatedRouteSnapshot>[];

Callers 3

recognize.spec.tsFile · 0.80
recognizeFunction · 0.80
recognizeFunction · 0.80

Calls 4

matchMethod · 0.95
splitFunction · 0.90
serializeMethod · 0.65

Tested by 1

recognizeFunction · 0.64