The module ... was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method
See original GitHub issuegetting this error after following the latest Quick Start example from scratch.
according to the FAQ this shouldn’t be needed?
Most application developers won’t need to add components to the entryComponents.
Angular adds certain components to entry components automatically. Components listed in @NgModule.bootstrap are added automatically. Components referenced in router configuration are added automatically. These two mechanisms account for almost all entry components.
not quite sure how to troubleshoot it. The entire error looks like this:
core.umd.js:3468 Error: The module AppModule was bootstrapped, but it does not declare “@NgModule.bootstrap” components nor a “ngDoBootstrap” method. Please define one of these. at PlatformRef_._moduleDoBootstrap (core.umd.js:6966) at eval (core.umd.js:6928)
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
imports: [ BrowserModule ]
})
export class AppModule { }
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Related StackOverflow Question
I think you still need to add in @NgModule, as the FAQ, says the components added in @NgModule will be automatically loaded. So you need to import your new component and add the entries in @NgModule. Some thing like below/ BTW, this is part of quickstart.
import { AppComponent } from ‘./app.component’; @NgModule({ imports: [ BrowserModule ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] })
Why exactly do we have to import the same item twice? Some of these are NgModule and some are not. I wonder what the point was.