[ Web Proxy ]
URL:
Viewing: https://angular.dev/api/core/PlatformRef#bootstrapModule [Back]  [Original]

PlatformRef Angular Skip to main content
menu
close
more_horiz
menuAPI
@angular/core

PlatformRef

Class
stable

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.

On this page

    arrow_upward_alt Back to the top

    API

        
          class PlatformRef {  constructor(_injector: Injector);  bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>, options?: (BootstrapOptions & { applicationProviders?: (Provider | EnvironmentProviders)[] | undefined; }) | undefined): Promise<NgModuleRef<M>>;  bootstrapModule<M>(moduleType: Type<M>, compilerOptions?: (CompilerOptions & BootstrapOptions & { applicationProviders?: (Provider | EnvironmentProviders)[] | undefined; }) | (CompilerOptions & BootstrapOptions & { applicationProviders?: (Provider | EnvironmentProviders)[] | undefined; })[]): Promise<NgModuleRef<M>>;  onDestroy(callback: () => void): void;  readonly injector: Injector;  destroy(): void;  readonly destroyed: boolean;}
        
        

    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>
    @paramoptions(BootstrapOptions & { applicationProviders?: (Provider | EnvironmentProviders)[] | undefined; }) | undefined
    @returnsPromise<NgModuleRef<M>>

    bootstrapModule

    Promise<NgModuleRef<M>>

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

    @parammoduleTypeType<M>
    @paramcompilerOptions(CompilerOptions & BootstrapOptions & { applicationProviders?: (Provider | EnvironmentProviders)[] | undefined; }) | (CompilerOptions & BootstrapOptions & { applicationProviders?: (Provider | EnvironmentProviders)[] | undefined; })[]
    @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

    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

    Web Proxy Viewer  |  New URL  |  Original Page