Expected Behavior: A set of multiple choice questions is generated from a json file. Each question should consist of multiple options in the form of radio inputs. You should only be able to select one option at a time.
Expected Behavior -
Actual Behavior: Everything looks correct until you click on the radio buttons and then click on a different one and it wont deselect the previous one. You can end up selecting every single option if you keep clicking and you cant deselect any of them.
Actual Behavior -
Code Breakdown:
The base of it is the Review component where we loop through an array of Questions and generate a Question Component for each. We also build the FormGroup and pass it along. Each Question component generates a number of Option components in the exact same manner. The Option components each consist of a <input type="radio"> and a <label>
stackblitz.com/edit/angular-dynamically-generated-radio-buttons
Observations:
In the html for the Option component if I remove [formControlName]="name" from the <input> then it corrects the issue i'm having, but that's integral to Reactive Forms. I must be doing something wrong here specifically, but for the life of me I cant figure it out. Its behaving like each option has its own form control, or at least how I imagine that would work.
Below you can see a log of the formgroup, aswell as the html for Question 1: Options 1&2. As far as I can tell it is as it should be. Help please!
Log of FormGroup -
html of Question1, Options1&2 -



