I have an input component customInput
that creates a classic input field and adds some layouting-spice to it, no additional logic.
I want to pass a formControl to it, to bind it to the input it contains.
Should be used like this:
<form [formGroup]="form">
<custom-input [formControl]="form.controls['control']"></custom-input>
</form>
Inside Custom Input:
export class HidInputFieldComponent {
@Input() formControl: AbstractControl
...
}
<div class="container">
<input [formControl]="formControl"/>
<label>label</label>
</div>
Now when i initialize the component, i get
No value accessor for form control with unspecified name
Logging the control in my components constructor, it is undefined.
Am I doing it wrong or isn't there a way around ControlValueAccessor
? Since I am not actually building a custom control (I still use classic input) it seems extreme