Hi everyone, i want to make a custom input component which consumes a Formcontrol of the parent. However i am getting an error which says: "No value accessor for form control unspecified name attribute.". Beside the error the component works and i can access the value of it in the parent component. So why does this error comes up?
#Custom Input-component
5 messages · Page 1 of 1 (latest)
This happens, because [formControl] causes Angular to apply the FormControlDirective from reactive forms to your component. This then fails, because your component is not an <input> (or rather, not a ControlValueAccessor).
The error message now makes a little more sense: "No value accessor [ControlValueAccessor, so <input> element] for form control unspecified name attribute" (the italics part is actually the name of the form control, but yours is unnamed...).
The resolution is to rename your input to something other than formControl.
omg, what a stupid mistake haha. Thank you!
I had literally the exact same thing 3 days ago