Angular 5: “No provider for ControlContainer”

前端 未结 12 1197
独厮守ぢ
独厮守ぢ 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:02

    The ControlContainer is a abstract class which is extended by the AbstractFormGroupDirective inside the ReactiveFormsModule.

    The error is thrown if you're using the ReactiveFormsModule and a

    -element without a FormGroup bound to it via [formGroup]="myForm".

    To fix this error you have to create a FormGroup and bind it to your form:

    
    

    Also make sure you have both the FormsModule and the ReactiveFormsModule added to your module imports.

提交回复
热议问题