Find the parent environment injector of the given injector.
(injector: Injector)
| 247 | |
| 248 | /** Find the parent environment injector of the given injector. */ |
| 249 | function getParentEnvInjector(injector: Injector): Injector | undefined { |
| 250 | if (injector instanceof ChainedInjector) { |
| 251 | // We skip `chainedInjector.injector` because that points at the parent element injector |
| 252 | // which is handled by `walkElementInjectors`. |
| 253 | const chainedInjector = injector; |
| 254 | return chainedInjector.parentInjector; |
| 255 | } else if (injector instanceof R3Injector) { |
| 256 | return injector.parent; |
| 257 | } else if (injector instanceof NullInjector) { |
| 258 | return undefined; |
| 259 | } else { |
| 260 | throw new Error(`Unknown injector type: "${injector.constructor.name}".`); |
| 261 | } |
| 262 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…