MCPcopy
hub / github.com/angular/angular / match

Method match

packages/router/src/recognize.ts:117–155  ·  view source on GitHub ↗
(rootSegmentGroup: UrlSegmentGroup)

Source from the content-addressed store, hash-verified

115 }
116
117 private async match(rootSegmentGroup: UrlSegmentGroup): Promise<{
118 children: TreeNode<ActivatedRouteSnapshot>[];
119 rootSnapshot: ActivatedRouteSnapshot;
120 }> {
121 // Use Object.freeze to prevent readers of the Router state from modifying it outside
122 // of a navigation, resulting in the router being out of sync with the browser.
123 const rootSnapshot = new ActivatedRouteSnapshot(
124 [],
125 Object.freeze({}),
126 Object.freeze({...this.urlTree.queryParams}),
127 this.urlTree.fragment,
128 Object.freeze({}),
129 PRIMARY_OUTLET,
130 this.rootComponentType,
131 null,
132 {},
133 this.injector,
134 );
135 try {
136 const children = await this.processSegmentGroup(
137 this.injector,
138 this.config,
139 rootSegmentGroup,
140 PRIMARY_OUTLET,
141 rootSnapshot,
142 );
143 return {children, rootSnapshot};
144 } catch (e: any) {
145 if (e instanceof AbsoluteRedirect) {
146 this.urlTree = e.urlTree;
147 return this.match(e.urlTree.root);
148 }
149 if (e instanceof NoMatch) {
150 throw this.noMatchError(e);
151 }
152
153 throw e;
154 }
155 }
156
157 async processSegmentGroup(
158 injector: EnvironmentInjector,

Callers 15

recognizeMethod · 0.95
_aggregateEventsMethod · 0.45
normalizeEventFunction · 0.45
getAppContentsFunction · 0.45
getFirstClassDeclarationFunction · 0.45
matchSegmentsFunction · 0.45
matchMatrixKeySegmentsFunction · 0.45
matchQueryParamsFunction · 0.45
matchUrlQueryParamValueFunction · 0.45
getDirectiveRequireMethod · 0.45

Calls 2

processSegmentGroupMethod · 0.95
noMatchErrorMethod · 0.95

Tested by

no test coverage detected