2014-02-09 41 views
0
<li ng-repeat="flagVm in flagVms track by $id(flagVm)"> 
    <label for="alternative{{$index}}" ng-click="alternativeClicked()"> 
     <input ng-model="$parent.alternative" value="{{ flagVm.id }}" type="radio" name="alternative{{$index}}" /> 
     <span class="num-times-flagged">(Flagged {{ flagVm.count }} {{ flagVm.count > 1 ? 'times' : 'time' }}) </span> 
     Inference Id: 
     <span class="highlighted-id">{{ flagVm.duplicateId }}</span> 
    </label> 
</li> 

为什么没有被标记为选择(我必须单击两次)我的角度单选按钮

$scope.alternativeClicked = function (id) 
{ 
    //once iterating will probably be the actual flag obj 
    $scope.alternativeFound = 'yes'; 
}; 

回答

1

我认为使用ng-click无线电是一种不好的做法。

更好的办法是用ng-change$watch值变化

相关问题