1
我有一个简单的NG重复与拒绝功能的单选按钮。以下作品完美的罚款:为什么使用ng-repeat的单选按钮不起作用?
<label class="radio-inline">
<input type="radio" ng-model="display_as" name="display_as" value="1">position 1
<input type="radio" ng-model="display_as" name="display_as" value="2">position 2
</label>
<pre>{{ display_as }}</pre>
但我确实看到两个单选按钮(如预期),我可以选择两个单选按钮eitherone以下,但仍$scope.display_as
不确定。
<label ng-repeat="position in user.positions" class="radio-inline">
<input type="radio" ng-model="display_as" name="display_as" value="{{ $index }}">{{ position.name }}
</label>
<pre>{{ display_as }}</pre>
为什么哦为什么?!有没有人能告诉我我在做什么错在我的ng-repeat
?
对于一些神秘的,如果你使用user.display_as,它的工作原理(http://jsbin.com/yaseye/edit?html,js,output)。 Excelent @ andrei-gheorghiu,在过去,我遇到了同样的问题,我只用了ng-change。 –