MCPcopy
hub / github.com/angular/angular / get

Method get

packages/examples/core/di/ts/injector_spec.ts:24–31  ·  view source on GitHub ↗
(token: ProviderToken<T>, defaultValue?: any, options?: any)

Source from the content-addressed store, hash-verified

22 constructor(readonly parent: Injector) {}
23
24 get<T>(token: ProviderToken<T>, defaultValue?: any, options?: any): T {
25 if ((token as any).ɵprov && (token as any).ɵprov.providedIn === 'root') {
26 return runInInjectionContext(this, () => {
27 return (token as any).ɵprov.factory();
28 });
29 }
30 return this.parent.get(token, defaultValue, options);
31 }
32}
33
34{

Callers

nothing calls this directly

Calls 3

runInInjectionContextFunction · 0.90
factoryMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected