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

Function resolveNode

packages/router/src/operators/resolve_data.ts:101–127  ·  view source on GitHub ↗
(
  resolve: ResolveData,
  futureARS: ActivatedRouteSnapshot,
  futureRSS: RouterStateSnapshot,
)

Source from the content-addressed store, hash-verified

99}
100
101function resolveNode(
102 resolve: ResolveData,
103 futureARS: ActivatedRouteSnapshot,
104 futureRSS: RouterStateSnapshot,
105): Observable<any> {
106 const keys = getDataKeys(resolve);
107 if (keys.length === 0) {
108 return of({});
109 }
110 const data: {[k: string | symbol]: any} = {};
111 return from(keys).pipe(
112 mergeMap((key) =>
113 getResolver(resolve[key], futureARS, futureRSS).pipe(
114 first(),
115 tap((value: any) => {
116 if (value instanceof RedirectCommand) {
117 throw redirectingNavigationError(new DefaultUrlSerializer(), value);
118 }
119 data[key] = value;
120 }),
121 ),
122 ),
123 takeLast(1),
124 map(() => data),
125 catchError((e: unknown) => (isEmptyError(e as Error) ? EMPTY : throwError(e))),
126 );
127}
128
129function getResolver(
130 injectionToken: ProviderToken<any> | Function,

Callers 1

runResolveFunction · 0.85

Calls 7

getDataKeysFunction · 0.90
isEmptyErrorFunction · 0.90
getResolverFunction · 0.85
firstFunction · 0.85
catchErrorFunction · 0.85
throwErrorFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…