Unexpected value 'undefined' declared by the module 'AppModule'

前端 未结 14 1818
庸人自扰
庸人自扰 2021-02-03 16:53

What is wrong here? I\'m trying to make it work but I get that error in the header. I have included the in the app

相关标签:
14条回答
  • 2021-02-03 17:17

    In My scenario, I made mistake like below

      @NgModule({
      imports: [RouterModule.forChild(routes)],
      exports: [RouterModule]
    })
    export class NewTestRoutingModule {
      static component : [NewTestContainerComponent, NewTestInletComponent, NewTestStructureComponent]
    }
    

    and in Module

    @NgModule({
      declarations: [LayersRoutingModule.component],
    

    The components array in Routing should be like this.

     static component = [NewTestContainerComponent, NewTestInletComponent, NewTestStructureComponent]
    
    0 讨论(0)
  • 2021-02-03 17:21

    This happened to me as well, in @Component I wrote selector: all-employees and in app.module.ts module it was <all- employees></all- employees>

    0 讨论(0)
  • 2021-02-03 17:25

    I was getting this error because I mistakenly put TestBed.configureTestingModule outside of a beforeEach block.

    0 讨论(0)
  • 2021-02-03 17:27

    Experienced this with Angular 2 and it turns out it has something to do with imports and relative paths, if you're exporting something in from the same location

    For instance when using barrels, explicitly specify the ./

    export * from './create-profile.component';
    

    instead of

    export * from 'create-profile.component';
    
    0 讨论(0)
  • 2021-02-03 17:31

    In my case, on app.module.ts ( Ionic 3 )

    providers: [
        , StatusBar
        , SplashScreen
    

    Changed to:

    providers: [
         StatusBar
        , SplashScreen
    

    And works.

    0 讨论(0)
  • 2021-02-03 17:32

    It was caused because I repeated the export in one of my index.ts file:

    0 讨论(0)
提交回复
热议问题