Please add a @Pipe/@Directive/@Component annotation. Error

后端 未结 11 2230
滥情空心
滥情空心 2021-02-06 21:29

I am stuck in a situation here. I am getting an error like this.

 compiler.es5.js:1694 Uncaught Error: Unexpected value \'LoginComponent\' declared by the modul         


        
11条回答
  •  梦谈多话
    2021-02-06 22:09

    I faced the same error when I used another class instead of component down the component decorator.

    Component class must come just after the component decorator

      @Component({
     selector: 'app-smsgtrecon',
     templateUrl: './smsgtrecon.component.html',
     styleUrls: ['./smsgtrecon.component.css'],
     providers: [ChecklistDatabase]
     })
    
    
    // THIS CAUSE ISSUE MOVE THIS UP TO COMPONENT DECORATOR
    /**
    * Node for to-do item
    */
     export class TodoItemNode {
     children: TodoItemNode[];
     item: string;
    }
    
    
     export class SmsgtreconComponent implements OnInit {
    

    After moving TodoItemNode to the top of component decorator it worked

    Solution

    // THIS CAUSE ISSUE MOVE THIS UP TO COMPONENT DECORATOR
    /**
    * Node for to-do item
    */
     export class TodoItemNode {
     children: TodoItemNode[];
     item: string;
    }
    
    
    @Component({
     selector: 'app-smsgtrecon',
     templateUrl: './smsgtrecon.component.html',
     styleUrls: ['./smsgtrecon.component.css'],
     providers: [ChecklistDatabase]
     })
    
    
     export class SmsgtreconComponent implements OnInit {
    

提交回复
热议问题