MCPcopy Create free account
hub / github.com/angular/angular / createOrReusePlatformInjector

Function createOrReusePlatformInjector

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

Source from the content-addressed store, hash-verified

163 * This function is needed for bootstrapping a Standalone Component.
164 */
165export 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

Callers 2

createPlatformInjectorFunction · 0.85

Calls 5

registerAiToolsFunction · 0.90
runPlatformInitializersFunction · 0.85
createPlatformInjectorFunction · 0.70

Tested by

no test coverage detected