The project manager doesn't want to have a "none" option on radio buttons, so I need to have checkboxes behave like radio buttons.
Can I do this without jQuery?
BTW, the following directive sort of works, but Angular doesn't pick up on a change when the item is switched:
HTML:
<div ng-repeat="i in options">
<input type="checkbox" name="pumpingOptions" ng-model="i.qty" ng-change="getPartNumberValue(i)" value="{{
i.name}}" unique-checkbox class="uniqueCheckbox"> {{
i.name}}<br/>
</div>
JS:
App.directive('uniqueCheckbox', function() {
return {
retrict: 'A',
link: function(scope, element) {
element.click(function() {
scope.$apply($('input.uniqueCheckbox:checked').not(this).removeAttr('checked'));
});
}
}
});
Any help would be greatly appreciated. I can put the whole thing into Plunker if needed - let me know.
Thanks,
Dave