I\'ve tried to use the html5 required
attribute for my group of checkboxes but I don\'t find a nice way to implement it with ng-form.
When a checkbox is che
A few things:
rather than
.ng-click
and into the form's ng-submit
. This makes validation management a little easier with angular's built-in validation (if you care about that)
wraps your
you don't need the for=""
attribute.Here is an updated fiddle for you
And here's the code:
{{value}}
JS
function myCtrl($scope) {
$scope.choices = [{
"id": 1,
"value": "1",
"label": "Good"},
{
"id": 2,
"value": "2",
"label": "Ok"},
{
"id": 3,
"value": "3",
"label": "Bad"}];
$scope.value = [];
$scope.updateQuestionValues = function() {
$scope.value = _.filter($scope.choices, function(c) {
return c.checked;
});
};
}