MCPcopy Create free account
hub / github.com/angular/angular / recognize

Method recognize

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

Source from the content-addressed store, hash-verified

103 }
104
105 async recognize(): Promise<{state: RouterStateSnapshot; tree: UrlTree}> {
106 const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
107
108 const {children, rootSnapshot} = await this.match(rootSegmentGroup);
109 const rootNode = new TreeNode(rootSnapshot, children);
110 const routeState = new RouterStateSnapshot('', rootNode);
111 const tree = createUrlTreeFromSnapshot(
112 rootSnapshot,
113 [],
114 this.urlTree.queryParams,
115 this.urlTree.fragment,
116 );
117 // Creating the tree stringifies the query params
118 // We don't want to do this here to preserve pre-existing behavior
119 // so reassign them to the original.
120 tree.queryParams = this.urlTree.queryParams;
121 routeState.url = this.urlSerializer.serialize(tree);
122 return {state: routeState, tree};
123 }
124
125 private async match(rootSegmentGroup: UrlSegmentGroup): Promise<{
126 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