PlatformRef
The Angular platform is the entry point for Angular on a web page.
Each page has exactly one platform. Services (such as reflection) which are common
to every Angular application running on the page are bound in its scope.
A page's platform is initialized implicitly when a platform is created using a platform
factory such as PlatformBrowser, or explicitly by calling the createPlatform() function.
constructor
PlatformRefPlatformRefbootstrapModuleFactory
Promise<NgModuleRef<M>>bootstrapModule
Promise<NgModuleRef<M>>Creates an instance of an @NgModule for a given platform.
Promise<NgModuleRef<M>>Simple Example
@NgModule({ imports: [BrowserModule]})class MyModule {}let moduleRef = platformBrowser().bootstrapModule(MyModule);
onDestroy
voidRegisters a listener to be called when the platform is destroyed.
() => voidvoidinjector
InjectorRetrieves the platform Injector, which is the parent injector for
every Angular application on the page and provides singleton providers.
destroy
voidDestroys the current Angular platform and all Angular applications on the page. Destroys all modules and listeners registered with the platform.
voiddestroyed
booleanIndicates whether this instance was destroyed.