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

Class MockRootScopeInjector

packages/examples/core/di/ts/injector_spec.ts:21–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19// `InjectOptions` once #60318 is released.
20
21class MockRootScopeInjector implements Injector {
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{
35 describe('injector metadata examples', () => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…