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

Function getChildRouteGuards

packages/router/src/utils/preactivation.ts:84–108  ·  view source on GitHub ↗
(
  futureNode: TreeNode<ActivatedRouteSnapshot>,
  currNode: TreeNode<ActivatedRouteSnapshot> | null,
  contexts: ChildrenOutletContexts | null,
  futurePath: ActivatedRouteSnapshot[],
  checks: Checks = {
    canDeactivateChecks: [],
    canActivateChecks: [],
  },
)

Source from the content-addressed store, hash-verified

82}
83
84function getChildRouteGuards(
85 futureNode: TreeNode<ActivatedRouteSnapshot>,
86 currNode: TreeNode<ActivatedRouteSnapshot> | null,
87 contexts: ChildrenOutletContexts | null,
88 futurePath: ActivatedRouteSnapshot[],
89 checks: Checks = {
90 canDeactivateChecks: [],
91 canActivateChecks: [],
92 },
93): Checks {
94 const prevChildren = nodeChildrenAsMap(currNode);
95
96 // Process the children of the future route
97 futureNode.children.forEach((c) => {
98 getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
99 delete prevChildren[c.value.outlet];
100 });
101
102 // Process any children left from the current route (not active for the future route)
103 Object.entries(prevChildren).forEach(([k, v]: [string, TreeNode<ActivatedRouteSnapshot>]) =>
104 deactivateRouteAndItsChildren(v, contexts!.getContext(k), checks),
105 );
106
107 return checks;
108}
109
110function getRouteGuards(
111 futureNode: TreeNode<ActivatedRouteSnapshot>,

Callers 2

getAllRouteGuardsFunction · 0.85
getRouteGuardsFunction · 0.85

Calls 6

nodeChildrenAsMapFunction · 0.90
getRouteGuardsFunction · 0.85
getContextMethod · 0.65
forEachMethod · 0.45
entriesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…