| 16 | * injector. Used primarily when creating components or embedded views dynamically. |
| 17 | */ |
| 18 | export class ChainedInjector implements Injector { |
| 19 | constructor( |
| 20 | public injector: Injector, |
| 21 | public parentInjector: Injector, |
| 22 | ) {} |
| 23 | |
| 24 | get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T { |
| 25 | const value = this.injector.get<T | typeof NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR>( |
| 26 | token, |
| 27 | NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, |
| 28 | options, |
| 29 | ); |
| 30 | |
| 31 | if ( |
| 32 | value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || |
| 33 | notFoundValue === (NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as unknown as T) |
| 34 | ) { |
| 35 | // Return the value from the root element injector when |
| 36 | // - it provides it |
| 37 | // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) |
| 38 | // - the module injector should not be checked |
| 39 | // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) |
| 40 | return value as T; |
| 41 | } |
| 42 | |
| 43 | return this.parentInjector.get(token, notFoundValue, options); |
| 44 | } |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…