BrowserModule has already been loaded Error

后端 未结 10 2289
猫巷女王i
猫巷女王i 2020-12-08 18:56

I\'ve updated my application to RC6 and now i keep getting this error:

zone.js:484 Unhandled Promise rejection: BrowserModule has already been loade

10条回答
  •  醉话见心
    2020-12-08 19:32

    I've encountered a simular problem. I have serveral lazyloading modules which all use BrowserAnimationModule(Includes BrowserModule).

    My solution first is to move the importation of this module from the child module to the root module as app.module.ts.

    //app.module.ts
    @NgModule({
        declarations: [  ],
        imports: [    BrowserAnimationsModule,]
    

    The second step is quite essential, you should also include the CommonModule in each child module .

    //lazychild.module.ts
    @NgModule({
      declarations: [  ],
      imports: [  CommonModule,]
    

提交回复
热议问题