Linked Questions

Popular Questions

I need dynamic number of radio buttons based on the length of Array Of Objects (eg: enum_details):

Following is the code I tried:

<div *ngFor="let enum of enum_details">
  <label for="enum_answer_{{enum.value}}">
    <input id="enum_answer_{{enum.value}}" type="radio" name="enums" [(ngModel)]="enum.value">
    {{enum.display_text}}
  </label>
</div>

But, when I click any radio, always the last one gets selected and the value is never assigned to ngModel.

If I remove ngModel, the radios work fine, but, value is not set. What can be the fix here?

Related Questions