( futureRSS: RouterStateSnapshot, path: ActivatedRouteSnapshot[], )
| 172 | } |
| 173 | |
| 174 | function runCanActivateChild( |
| 175 | futureRSS: RouterStateSnapshot, |
| 176 | path: ActivatedRouteSnapshot[], |
| 177 | ): Observable<GuardResult> { |
| 178 | const futureARS = path[path.length - 1]; |
| 179 | |
| 180 | const canActivateChildGuards = path |
| 181 | .slice(0, path.length - 1) |
| 182 | .reverse() |
| 183 | .map((p) => getCanActivateChild(p)) |
| 184 | .filter((_) => _ !== null); |
| 185 | |
| 186 | const canActivateChildGuardsMapped = canActivateChildGuards.map((d: any) => { |
| 187 | return defer(() => { |
| 188 | const guardsMapped = d.guards.map( |
| 189 | (canActivateChild: CanActivateChildFn | ProviderToken<unknown>) => { |
| 190 | const closestInjector = d.node._environmentInjector; |
| 191 | const guard = getTokenOrFunctionIdentity<{canActivateChild: CanActivateChildFn}>( |
| 192 | canActivateChild, |
| 193 | closestInjector, |
| 194 | ); |
| 195 | const guardVal = isCanActivateChild(guard) |
| 196 | ? guard.canActivateChild(futureARS, futureRSS) |
| 197 | : runInInjectionContext(closestInjector, () => |
| 198 | (guard as CanActivateChildFn)(futureARS, futureRSS), |
| 199 | ); |
| 200 | return wrapIntoObservable(guardVal).pipe(first()); |
| 201 | }, |
| 202 | ); |
| 203 | return of(guardsMapped).pipe(prioritizedGuardValue()); |
| 204 | }); |
| 205 | }); |
| 206 | return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue()); |
| 207 | } |
| 208 | |
| 209 | function runCanDeactivate( |
| 210 | component: Object | null, |
no test coverage detected
searching dependent graphs…