MCPcopy
hub / github.com/angular/angular / createOrReusePlatformInjector

Function createOrReusePlatformInjector

packages/core/src/platform/platform.ts:172–194  ·  view source on GitHub ↗
(providers: StaticProvider[] = [])

Source from the content-addressed store, hash-verified

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

Callers 2

createPlatformInjectorFunction · 0.85

Calls 5

registerAiToolsFunction · 0.90
runPlatformInitializersFunction · 0.85
createPlatformInjectorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…