我有以下代码:
<li ng-repeat="(key, value) in languages_sys">
<input type="radio" ng-click="changeDefaultLanguage(key)" ng-value="{{key}}" ng-model="language">
<span>{{value}}</span>
</li>
当我点击输入时,它没有被选中,即被选中。
languages_sys
的对象为:
{"0" : "Spain", "1": "England"};
答案 0 :(得分:1)
将name="language"
添加到输入中,并将ng-value
替换为value
:
<input name="language" type="radio" ng-click="..." value="{{key}}" ng-model="language">
参见 fiddle