What causes the “control.registerOnChange is not a function” error

后端 未结 10 2082
一向
一向 2020-12-01 20:39

I have a form using the reactive form approach. The form is created as follow in my pug:

form([formGroup]=\'form\', novalidate=\'\', (ngSubmit)=\'postSurvey(         


        
10条回答
  •  广开言路
    2020-12-01 20:56

    Yes, that error message is a bit cryptic, but if you use FormBuilder, you would see this when you added a control to FormGroup in your component and named it "A", but then either forgot to add input with formControlName="A" to your template, or formControlName for the intended input is not A, or empty, or not present.

    Basically, it says: "I cannot match the control I have in FormGroup to the control in the template".

提交回复
热议问题