复选框不能用作单选按钮

时间:2015-10-27 14:14:10

标签: angularjs checkbox

我正在尝试将复选框设置为单选按钮,以便它一次只能选择一个值。

HTML

<tr data-ng-repeat="serviceTable in dataTable ">  
    <td> {{ serviceTable.serviceId }} </td>
    <td> {{ serviceTable.serviceName }} </td>
    <td> {{ serviceTable. amount }} </td>
    <td><input type="checkbox" ng-model="serviceId" ng-true-value="{{ serviceTable.serviceId }}" ng-change=" test(serviceTable.serviceId)" ng-required="!{{ serviceTable.serviceId }}"  ></td>
</tr>

JS

$scope.test = function(val) {

                   $scope.serviceId = val;

                    }

允许选择多个复选框。任何解决方案?

0 个答案:

没有答案