| 47 | * This is used to allow the `inject` function to be used with the new primitives-based DI system. |
| 48 | */ |
| 49 | export class RetrievingInjector implements PrimitivesInjector { |
| 50 | constructor(readonly injector: Injector) {} |
| 51 | retrieve<T>(token: PrimitivesInjectionToken<T>, options: unknown): T | NotFound { |
| 52 | const flags: InternalInjectFlags = |
| 53 | convertToBitFlags(options as InjectOptions | undefined) || InternalInjectFlags.Default; |
| 54 | try { |
| 55 | return (this.injector as BackwardsCompatibleInjector).get( |
| 56 | token as unknown as InjectionToken<T>, |
| 57 | // When a dependency is requested with an optional flag, DI returns null as the default value. |
| 58 | (flags & InternalInjectFlags.Optional ? null : THROW_IF_NOT_FOUND) as T, |
| 59 | flags, |
| 60 | ) as T; |
| 61 | } catch (e: any) { |
| 62 | if (isNotFound(e)) { |
| 63 | return e; |
| 64 | } |
| 65 | throw e; |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | export const NG_TEMP_TOKEN_PATH = 'ngTempTokenPath'; |
| 71 | const NG_TOKEN_PATH = 'ngTokenPath'; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…