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

Method recognize

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

Source from the content-addressed store, hash-verified

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