mardi 27 octobre 2015

Checkbox is not functioning as a radio button

I'm trying to make checkbox as a radio button so that it should select only one value at a time.

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;

                    }

It is allowing to select multiple checkboxes. Any solution?




Aucun commentaire:

Enregistrer un commentaire