I have a set of radio buttons on my component that are simple yes and no values. It uses text as the label and an id for its value.
I am trying to assign an object as its value so that when I submit my form, I can get access to both the value and text.
Here is what I have tried:
<label class="radio-inline">
<input type="radio" formControlName="changeType" ng-value="{value:0, text:'No'}"> No
</label>
<label class="radio-inline">
<input type="radio" formControlName="changeType" ng-value="{value:1, text:'Yes'}"> Yes
</label>
When I try this, it fails my reactiveForms validation as being a required field. How can I assign this object where the validation will pass when one of them is selected?
ng-valueis from angularjs - usevaluevaluesubmitting the form:changeType:"{value:2, text:'Yes'}"<- treats it as a string[ngValue]="{....}"Can't bind to 'ngValue' since it isn't a known property of 'input'.