Is there a way to implement single selection on checkboxes, similar to an HTML "select" element?
I currently have a basic HTML table structure:
<tr ng-repeat="subscription in entities">
<td>
<input type="checkbox" ng-checked="isChecked(subscription)" ng-click="toggleSelection(subscription)"/>
</td>
</tr>
In addition, I have defined some simple controller functions for these directives:
$scope.isChecked = function(entity) {
return $scope.checkedEntity === entity;
};
$scope.toggleSelection = function(entity) {
entity.checked = !entity.checked;
if (entity.checked) {
$scope.checkedEntity = entity;
} else {
$scope.checkedEntity = null;
}
};
However, it seems that the current implementation is not functioning as expected. Upon investigation, I discovered that ng-click has a priority of 0 compared to ng-checked with a priority of 100.
Are there any elegant solutions available to solve this issue?