Is there a way to implement comprehension expressions similar to those used in ng-options
, but for grouping radio buttons or checkboxes?
app.js
angular
.module("app", [])
.controller("controller", ["$scope", function($scope){
$scope.selectedRadio = null;
$scope.selectedCheckboxes = [];
$scope.radioOptions = [
//some options...
];
$scope.checkboxOptions = [
//some options...
];
}]);
index.html
<div data-ng-app="app" data-ng-controller="controller>
<radio-group ng-radios="option as option.option_label
for option in radioOptions
track by option.option_id"
ng-model="selectedRadio"
ng-selected="option.selected" />
<checkbox-group ng-checkboxes="option as option.option_label
for option in checkboxOptions
track by option.option_id"
ng-model="selectedCheckboxes"
ng-selected="option.selected" />
</div>
I would like to find a solution that does not involve using complex regex to handle different forms of comprehension expressions.