I've the following component:
@Component({
selector: 'pc-radio-button',
templateUrl: './radio-button.component.html',
providers: [
{provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => FieldRadioButtonComponent), multi: true}
]
})
export class RadioButtonComponent implements ControlValueAccessor {
...
}
I can assign and alter the value through these inputs:
<pc-radio-button [formControl]="formControl"></pc-radio-button>
<pc-radio-button [formControlName]="inputControlName"></pc-radio-button>
However I need the component to have the direct access to the assigned formControl, as I need to add styles depending on its status.
By creating an @Input() formControl does not solve the problem. As it does not cover the case when form control is assigned via formControlName.