【发布时间】:2014-05-21 19:36:18
【问题描述】:
我正在制作一个单选按钮列表,用户可以在其中从预先填充的问题列表中进行选择,或者选择“其他”单选按钮,然后输入他们的具体问题。
我可以让预先填充的单选按钮列表工作并设置问题(输出范围变量证实了这一点),但引入“其他”功能让我很困惑。当我选择其他时,它似乎没有绑定到范围变量。我注意到在 dom 中它缺少 class="ng-scope" 其他单选按钮似乎是从 ng-repeat 获得的,但我不确定这是否是问题所在。
<form>
// This part loops through the list of problems and makess radio buttons
<div ng-repeat="problem in selectedType['nature_of_problem']">
<input type="radio" ng-model="$parent.natureOfProblem" ng-value="problem"/>
</div>
// Ideally this part is where the "other" radio is, it's still in the form
<input type="radio" ng-model="natureOfProblem" ng-value="other" ng-checked="">
</form>
【问题讨论】:
标签: angularjs