(providers: StaticProvider[] = [])
| 163 | * This function is needed for bootstrapping a Standalone Component. |
| 164 | */ |
| 165 | export function createOrReusePlatformInjector(providers: StaticProvider[] = []): Injector { |
| 166 | // If a platform injector already exists, it means that the platform |
| 167 | // is already bootstrapped and no additional actions are required. |
| 168 | if (_platformInjector) return _platformInjector; |
| 169 | |
| 170 | publishDefaultGlobalUtils(); |
| 171 | if (typeof ngDevMode !== 'undefined' && ngDevMode) { |
| 172 | _unregisterAiTools = registerAiTools(); |
| 173 | } |
| 174 | |
| 175 | // Otherwise, setup a new platform injector and run platform initializers. |
| 176 | const injector = createPlatformInjector(providers); |
| 177 | |
| 178 | // During SSR, using this setting and using an injector from the global can cause the |
| 179 | // injector to be used for a different request due to concurrency. |
| 180 | if (typeof ngServerMode === 'undefined' || !ngServerMode) { |
| 181 | _platformInjector = injector; |
| 182 | } |
| 183 | |
| 184 | publishSignalConfiguration(); |
| 185 | runPlatformInitializers(injector); |
| 186 | return injector; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * @description |
no test coverage detected