0

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.

  1. When selected, the value should be true (like a checkbox). When not selected, it should be false.
  2. 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.

  1. Purple 🔘
  2. Red 🔘
  3. 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!

2
  • Bit unclear to understand, can you please provide a screenshot of expected behavior? And please rephrase/explain a more about scenarios? Commented Aug 25, 2022 at 13:44
  • @PankajParkar EX: 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. 1. Purple 🔘 2. Red 🔘 3. Green 🔘 Whichever of these is selected, the value needs to be true, rather than the value of whatever input it is attached to. Commented Aug 25, 2022 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.