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()
}
说明
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.
属性
属性 | 说明 |
---|---|
injector: Injector | 只读 Retrieve the platform |
destroyed | 只读 |
方法
Creates an instance of an | ||||||
参数
返回值
| ||||||
使用说明Simple Example
|
Creates an instance of an | ||||||
参数
返回值
| ||||||
使用说明Simple Example
|
Register a listener to be called when the platform is disposed. |
Destroy the Angular platform and all Angular applications on the page. |
参数没有参数。 |