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

Function createPlatformInjector

packages/core/src/platform/platform.ts:94–103  ·  view source on GitHub ↗

* Helper function to create an instance of a platform injector (that maintains the 'platform' * scope).

(providers: StaticProvider[] = [], name?: string)

Source from the content-addressed store, hash-verified

92 * scope).
93 */
94function createPlatformInjector(providers: StaticProvider[] = [], name?: string): Injector {
95 return Injector.create({
96 name,
97 providers: [
98 {provide: INJECTOR_SCOPE, useValue: 'platform'},
99 {provide: PLATFORM_DESTROY_LISTENERS, useValue: new Set([() => (_platformInjector = null)])},
100 ...providers,
101 ],
102 });
103}
104
105/**
106 * Checks that there is currently a platform that contains the given token as a provider.

Callers 2

createPlatformFactoryFunction · 0.70

Calls 1

createMethod · 0.65

Tested by

no test coverage detected