Unexpected value 'DecoratorFactory' imported by the module 'TempModule'

后端 未结 3 954
一生所求
一生所求 2021-01-04 02:53

In my sample application I have written a feature module \"TempModule\" and below is the code.

import { NgModule } from \'@angular/core\';
import { CommonMod         


        
相关标签:
3条回答
  • 2021-01-04 03:18

    You're trying to import decorator in imports array. It should contain only modules

    @NgModule({
      declarations: [ TempOneComponent,
                    TempTwoComponent],
      imports: [ NgModule, <== why is it here???
               CommonModule,
               tempRouting]
    }) 
    export class TempModule {}
    
    0 讨论(0)
  • 2021-01-04 03:19

    Solved by adding below code in hero-detail component.

    import { NgModule } from '@angular/core';
    
    0 讨论(0)
  • 2021-01-04 03:20

    Another way you can see this error is by importing a module from the wrong place. For example:

    import {CommonModule} from '@angular/core';  // wrong
    

    should be:

    import {CommonModule} from '@angular/common';
    
    0 讨论(0)
提交回复
热议问题