MCPcopy Create free account
hub / github.com/angular/angular / _moduleDoBootstrap

Function _moduleDoBootstrap

packages/core/src/platform/bootstrap.ts:196–215  ·  view source on GitHub ↗
(
  moduleRef: InternalNgModuleRef<any>,
  allPlatformModules: NgModuleRef<unknown>[],
)

Source from the content-addressed store, hash-verified

194}
195
196function _moduleDoBootstrap(
197 moduleRef: InternalNgModuleRef<any>,
198 allPlatformModules: NgModuleRef<unknown>[],
199): void {
200 const appRef = moduleRef.injector.get(ApplicationRef);
201 if (moduleRef._bootstrapComponents.length > 0) {
202 moduleRef._bootstrapComponents.forEach((f) => appRef.bootstrap(f));
203 } else if (moduleRef.instance.ngDoBootstrap) {
204 moduleRef.instance.ngDoBootstrap(appRef);
205 } else {
206 throw new RuntimeError(
207 RuntimeErrorCode.BOOTSTRAP_COMPONENTS_NOT_FOUND,
208 ngDevMode &&
209 `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, ` +
210 `but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` +
211 `Please define one of these.`,
212 );
213 }
214 allPlatformModules.push(moduleRef);
215}
216
217function _callAndReportToErrorHandler(
218 errorHandler: (e: unknown) => void,

Callers

nothing calls this directly

Calls 6

stringifyFunction · 0.90
getMethod · 0.65
ngDoBootstrapMethod · 0.65
forEachMethod · 0.45
bootstrapMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected