( token: ProviderToken<T>, flags = InternalInjectFlags.Default, )
| 43 | export function ɵɵdirectiveInject<T>(token: ProviderToken<T>): T; |
| 44 | export function ɵɵdirectiveInject<T>(token: ProviderToken<T>, flags: number): T; |
| 45 | export function ɵɵdirectiveInject<T>( |
| 46 | token: ProviderToken<T>, |
| 47 | flags = InternalInjectFlags.Default, |
| 48 | ): T | null { |
| 49 | const lView = getLView(); |
| 50 | // Fall back to inject() if view hasn't been created. This situation can happen in tests |
| 51 | // if inject utilities are used before bootstrapping. |
| 52 | if (lView === null) { |
| 53 | // Verify that we will not get into infinite loop. |
| 54 | ngDevMode && assertInjectImplementationNotEqual(ɵɵdirectiveInject); |
| 55 | return ɵɵinject(token, flags); |
| 56 | } |
| 57 | const tNode = getCurrentTNode(); |
| 58 | const value = getOrCreateInjectable<T>( |
| 59 | tNode as TDirectiveHostNode, |
| 60 | lView, |
| 61 | resolveForwardRef(token), |
| 62 | flags, |
| 63 | ); |
| 64 | ngDevMode && emitInjectEvent(token as Type<unknown>, value, flags); |
| 65 | return value; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Throws an error indicating that a factory function could not be generated by the compiler for a |
nothing calls this directly
no test coverage detected