(debugFn: Function)
| 75 | * @publicApi |
| 76 | */ |
| 77 | export function assertInInjectionContext(debugFn: Function): void { |
| 78 | // Taking a `Function` instead of a string name here prevents the unminified name of the function |
| 79 | // from being retained in the bundle regardless of minification. |
| 80 | if (!isInInjectionContext()) { |
| 81 | throw new RuntimeError( |
| 82 | RuntimeErrorCode.MISSING_INJECTION_CONTEXT, |
| 83 | ngDevMode && |
| 84 | debugFn.name + |
| 85 | '() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`', |
| 86 | ); |
| 87 | } |
| 88 | } |
no test coverage detected
searching dependent graphs…