MCPcopy Index your code
hub / github.com/angular/angular / bootstrapModule

Method bootstrapModule

packages/core/src/platform/platform_ref.ts:87–102  ·  view source on GitHub ↗

* Creates an instance of an `@NgModule` for a given platform. * * @usageNotes * ### Simple Example * * ```ts * @NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * let moduleRef = platformBrowser().bootstrapModule(MyModule); * ``` *

(
    moduleType: Type<M>,
    compilerOptions:
      | (CompilerOptions &
          BootstrapOptions & {applicationProviders?: Array<Provider | EnvironmentProviders>})
      | Array<
          CompilerOptions &
            BootstrapOptions & {applicationProviders?: Array<Provider | EnvironmentProviders>}
        > = [],
  )

Source from the content-addressed store, hash-verified

85 *
86 */
87 bootstrapModule<M>(
88 moduleType: Type<M>,
89 compilerOptions:
90 | (CompilerOptions &
91 BootstrapOptions & {applicationProviders?: Array<Provider | EnvironmentProviders>})
92 | Array<
93 CompilerOptions &
94 BootstrapOptions & {applicationProviders?: Array<Provider | EnvironmentProviders>}
95 > = [],
96 ): Promise<NgModuleRef<M>> {
97 const options = optionsReducer({}, compilerOptions);
98 setModuleBootstrapImpl();
99 return compileNgModuleFactory(this.injector, options, moduleType).then((moduleFactory) =>
100 this.bootstrapModuleFactory(moduleFactory, options),
101 );
102 }
103
104 /**
105 * Registers a listener to be called when the platform is destroyed.

Callers 15

bootstrapFunction · 0.80
bootstrap_spec.tsFile · 0.80
bootstrapAppFunction · 0.80
main.tsFile · 0.80
bootstrapAppFunction · 0.80
bootstrap_spec.tsFile · 0.80
ng_module_spec.tsFile · 0.80

Calls 5

optionsReducerFunction · 0.90
setModuleBootstrapImplFunction · 0.90
compileNgModuleFactoryFunction · 0.90
thenMethod · 0.65

Tested by

no test coverage detected