I have a FormArray that dynamically produces pre-populated inputs for the purpose of displaying and editing. On each of these inputs there is a radio button attached to it.
I basically need a cross between a radio and a checkbox.
This is what I need to have.
- When selected, the value should be true (like a checkbox). When not selected, it should be false.
- I should only be able to select one of the inputs.
<div formArrayName="exampleForm">
<div *ngFor let ex of example.get('exampleForm')['controls]; let i = index>
<div [formGroupName]="i">
<example input field>
<input
type="radio"
name="exampleRadio"
formControlName="exampleRadio"
/>
<div>
<div>
<div>
Example:
Each of these would be inputs so the text is editable. Also it is dynamically created from the database, so there's no set amount of fields.
- Purple 🔘
- Red 🔘
- Green 🔘
Whichever of these is selected, the value needs to be true, rather than the value of whatever input it is attached to.
Thanks in advance!