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

前端 未结 10 2058
猫巷女王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条回答
  •  -上瘾入骨i
    2020-12-04 18:01

    If component has more than 1 form, register all controls and forms

    I needed to know why this was happening in a certain component and not in any other component.

    The issue was that I had 2 forms in one component and the second form didn't yet have [formGroup] and wasn't registered yet since I was still building the forms.

    I went ahead and completed writting both forms complete without leaving a input not registered which solve the issue.

提交回复
热议问题