I am trying to follow all the examples out there but I am not having any luck. I created a plunker using a jquery validation check. I need to only allow 1 checkbox selection out of the group. plunker
<body ng-controller="MainCtrl">
<div class="form-group fg-line">
<label for="companies" class="control-label"><b>Role Type</b></label><br /> <br />
<table>
<tr ng-repeat="model in userRoles">
<td>
<div class="checkbox m-b-15">
<label>
<input id="rolebox" class="check" type="checkbox" ng-model="model.RoleId">
<i class="input-helper"></i>
{{model.Name}}
</label>
</div>
</td>
</tr>
</table>
</div>
<script>
var checked = [],
$check = $('.check').change(function () {
if (this.value == -1 && this.checked) {
$check.not(this).prop('disabled', true).prop('checked', false);
checked = [];
}
else {
$check.prop('disabled', false);
checked.push(this);
checked = $(checked)
checked.prop('checked', false).slice(-2).prop('checked', true);
}
});
if ( $(":checkbox:checked").length > 1 ) { // more than one selected }