如何创建具有多个选项的动态单选按钮

How to create dynamic radio buttons with multiple options

我正在尝试创建一个带有多个单选按钮选项的动态表单并获取选定的值..

<form name="myForm" ng-submit="sendAnswers(question)">
      <ul>
        <li ng-repeat="question in questionForm.questions">
          <p>{{question.description}}</p>
          <ul>
            <li ng-repeat="option in question.options">
             <input type="radio" ng-model="question.answer" value="option.value">
             {{option.value}}
            </li>
          </ul>
        </li>
      </ul>
    <p><input type="submit" value="sendAnswers"></p>
 </form>

问题是当我点击按钮时,两个选项都被选中了..我做错了什么?

实例:http://plnkr.co/edit/aStk4SCHzAW0AKQuH7JE?p=preview

提前致谢!

添加一个"name"参数:

<input name="{{question.description}}" type="radio" ng-model="question.answer" value="option.value">

此外,您需要将 "value" 更改为 {{option.value}}

<input name="{{question.description}}" type="radio" ng-model="question.answer" value="{{option.value}}">

Working Example