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.
class PlatformRef {}
bootstrapModuleFactory
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
void
Registers a listener to be called when the platform is destroyed.
() => void
void
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.
void
destroyed
boolean
Indicates whether this instance was destroyed.