我正在尝试将复选框设置为单选按钮,以便它一次只能选择一个值。
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;
}
允许选择多个复选框。任何解决方案?