PlatformRef
The Angular platform is the entry point for Angular on a web page. Each page has exactly one platform, and services (such as reflection) which are common to every Angular application running on the page are bound in its scope.
interface PlatformRef {
injector: Injector
destroyed
bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>, options?: BootstrapOptions): Promise<NgModuleRef<M>>
bootstrapModule<M>(moduleType: Type<M>, compilerOptions: (CompilerOptions & BootstrapOptions) | (CompilerOptions & BootstrapOptions)[] = []): Promise<NgModuleRef<M>>
onDestroy(callback: () => void): void
destroy()
}
Description
A page's platform is initialized implicitly when a platform is created via a platform factory
(e.g. platformBrowser
), or explicitly by calling the createPlatform
function.
Properties
Property | Description |
---|---|
injector: Injector
|
Read-only.
Retrieve the platform |
destroyed
|
Read-only. |
Methods
Creates an instance of an |
||||||
Parameters
Returns
|
||||||
Usage NotesSimple Example
|
Creates an instance of an |
||||||
Parameters
Returns
|
||||||
Usage NotesSimple Example
|
Register a listener to be called when the platform is disposed. |
Destroy the Angular platform and all Angular applications on the page. |
ParametersThere are no parameters. |