| 194 | } |
| 195 | |
| 196 | function _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 | |
| 217 | function _callAndReportToErrorHandler( |
| 218 | errorHandler: (e: unknown) => void, |