• Overview
@angular/core

PlatformRef

Class

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.

  
    class PlatformRef {}
  
  

bootstrapModuleFactory

Promise<NgModuleRef<M>>

Creates an instance of an @NgModule for the given platform.

@deprecated

Passing NgModule factories as the PlatformRef.bootstrapModuleFactory function argument is deprecated. Use the PlatformRef.bootstrapModule API instead.

@parammoduleFactoryNgModuleFactory<M>
@paramoptionsBootstrapOptions | undefined
@returnsPromise<NgModuleRef<M>>

bootstrapModule

Promise<NgModuleRef<M>>

Creates an instance of an @NgModule for a given platform.

@parammoduleTypeType<M>
@returnsPromise<NgModuleRef<M>>
Usage notes

Simple Example

          
@NgModule({  imports: [BrowserModule]})class MyModule {}let moduleRef = platformBrowser().bootstrapModule(MyModule);

onDestroy

void

Registers a listener to be called when the platform is destroyed.

@paramcallback() => void
@returnsvoid

injector

Retrieves the platform Injector, which is the parent injector for every Angular application on the page and provides singleton providers.

destroy

void

Destroys the current Angular platform and all Angular applications on the page. Destroys all modules and listeners registered with the platform.

@returnsvoid

destroyed

boolean

Indicates whether this instance was destroyed.

Jump to details