Unexpected value 'undefined' imported by the module

后端 未结 3 559
北海茫月
北海茫月 2021-01-19 04:21

I thought I understood how ngModule worked but apparently not. I have 3 modules: AppModule, AmpedFormsModule, and AmpedCommonMod

3条回答
  •  盖世英雄少女心
    2021-01-19 05:00

    Its hard to say exact problem but there are few suggestions,

    1) change BroswerModule to CommonModule in AppCommonModule.Keep in mind BroswerModule should be imported by AppModule or RootModule only.

    @NgModule({
      imports       : [CommonModule, FormsModule],
      ...
    })
    

    2) Not sure but it seems you are creating circular dependencies by importing module into each other but as said not sure though.

    @NgModule({
      imports       : [FormsModule, AmpedFormsModule],      //<<< here
    })
    
    @NgModule({
      imports       : [ HttpModule, AmpedCommonModule ],    //<<< here
      ...
    })
    

    3) If AmpedFormsModule and AmpedCommonModule are lazy modules don't forget to put default keyword before class key word

    eg. export default class AmpedFormsModule {}
    

提交回复
热议问题