MCPcopy Index your code
hub / github.com/angular/angular / matchWithChecks

Function matchWithChecks

packages/router/src/utils/config_matching.ts:54–80  ·  view source on GitHub ↗
(
  segmentGroup: UrlSegmentGroup,
  route: Route,
  segments: UrlSegment[],
  injector: EnvironmentInjector,
  urlSerializer: UrlSerializer,
  createSnapshot: (result: MatchResult) => ActivatedRouteSnapshot,
  abortSignal: AbortSignal,
)

Source from the content-addressed store, hash-verified

52}
53
54export function matchWithChecks(
55 segmentGroup: UrlSegmentGroup,
56 route: Route,
57 segments: UrlSegment[],
58 injector: EnvironmentInjector,
59 urlSerializer: UrlSerializer,
60 createSnapshot: (result: MatchResult) => ActivatedRouteSnapshot,
61 abortSignal: AbortSignal,
62): Observable<MatchResult> {
63 const result = match(segmentGroup, route, segments);
64 if (!result.matched) {
65 return of(result);
66 }
67
68 const currentSnapshot = createPreMatchRouteSnapshot(createSnapshot(result));
69 // Only create the Route's `EnvironmentInjector` if it matches the attempted
70 // navigation
71 injector = getOrCreateRouteInjectorIfNeeded(route, injector);
72 return runCanMatchGuards(
73 injector,
74 route,
75 segments,
76 urlSerializer,
77 currentSnapshot,
78 abortSignal,
79 ).pipe(map((v) => (v === true ? result : {...noMatch})));
80}
81
82export function match(
83 segmentGroup: UrlSegmentGroup,

Callers 1

Calls 5

runCanMatchGuardsFunction · 0.90
matchFunction · 0.85
createSnapshotFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…