Angular 5: “No provider for ControlContainer”

前端 未结 12 1178
独厮守ぢ
独厮守ぢ 2020-12-14 14:50

I have a little web app with Angular 5 and out of a sudden I am getting this strange error message in my browser console:

ncaught Error: Template parse error         


        
12条回答
  •  隐瞒了意图╮
    2020-12-14 15:09

    Every time I encounter this error I make the mistake of using reactive forms and using an input named @Input formGroup in one of my own components.

    Error: Using reserved word for @Input

    Component

    @Input()
    formGroup: FormGroup;
    

    Using it

    
    
    

    Solution 1: Use other word for @Input

    Component

    @Input()
    form: FormGroup;
    

    Using it

    
    
    

    Solution 2: Alias the input

    Component

    @Input("form")
    formGroup: FormGroup;
    

    Using it

    
    
    

提交回复
热议问题