MCPcopy
hub / github.com/angular/angular / checkGuards

Function checkGuards

packages/router/test/router.spec.ts:905–926  ·  view source on GitHub ↗
(
  future: RouterStateSnapshot,
  curr: RouterStateSnapshot,
  injector: EnvironmentInjector,
  check: (result: GuardResult) => void,
)

Source from the content-addressed store, hash-verified

903}
904
905function checkGuards(
906 future: RouterStateSnapshot,
907 curr: RouterStateSnapshot,
908 injector: EnvironmentInjector,
909 check: (result: GuardResult) => void,
910): void {
911 // Since we only test the guards, we don't need to provide a full navigation
912 // transition object with all properties set.
913 of({
914 guards: getAllRouteGuards(future, curr, new ChildrenOutletContexts(injector)),
915 } as NavigationTransition)
916 .pipe(checkGuardsOperator())
917 .subscribe({
918 next(t) {
919 if (t.guardsResult === null) throw new Error('Guard result expected');
920 return check(t.guardsResult);
921 },
922 error(e) {
923 throw e;
924 },
925 });
926}

Callers

nothing calls this directly

Calls 2

getAllRouteGuardsFunction · 0.90
subscribeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…