ngModel cannot be used to register form controls with a parent formGroup directive

前端 未结 10 2063
猫巷女王i
猫巷女王i 2020-12-04 17:21

After upgrading to RC5 we began getting this error:

ngModel cannot be used to register form controls with a parent formGroup 
 directive.
Try using formGroup\         


        
10条回答
  •  孤城傲影
    2020-12-04 17:58

    Expanding on @Avenir Çokaj's answer

    Being a novice even I did not understand the error message clearly at first.

    What the error message indicates is that in your formGroup you have an element that doesn't get accounted for in your formControl. (Intentionally/Accidentally)

    If you intend on not validating this field but still want to use the ngModel on this input element please add the flag to indicate it's a standalone component without a need for validation as mentioned by @Avenir above.

提交回复
热议问题