title: AngularJS group check box validation
body: <p>I have a list of check boxes, of which at least one is compulsory. I have tried to achieve this via AngularJS validation, but had a hard time. Below is my code:</p>
  
  <pre class="lang-js prettyprint-override"><code>// Code goes here for js 
  
  var app = angular.module('App', []);
  
  function Ctrl($scope) {
    $scope.formData = {};
    $scope.formData.selectedGender = '';
    $scope.gender = [{
      'name': 'Male',
      'id': 1
    }, {
      'name': 'Female',
      'id': 2
    }];
    $scope.formData.selectedFruits = {};
    $scope.fruits = [{
      'name': 'Apple',
      'id': 1
    }, {
      'name': 'Orange',
      'id': 2
    }, {
      'name': 'Banana',
      'id': 3
    }, {
      'name': 'Mango',
      'id': 4
    }, ];
    $scope.submitForm = function() {
  
    }
  }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>// Code goes here for html
  &lt;!doctype html&gt;
  &lt;html ng-app="App"&gt;
  
  &lt;head&gt;
    &lt;!-- css file --&gt;
    &lt;!--App file --&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"&gt;&lt;/script&gt;
    &lt;!-- External file --&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div ng-controller="Ctrl"&gt;
      &lt;form class="Scroller-Container"&gt;
        &lt;div ng-app&gt;
  
          &lt;form class="Scroller-Container" ng-submit="submit()" ng-controller="Ctrl"&gt;
            &lt;div&gt;
              What would you like?
              &lt;div ng-repeat="(key, val) in fruits"&gt;
                &lt;input type="checkbox" ng-model="formData.selectedFruits[val.id]" name="group[]" id="group[{{val.id}}]" required /&gt;{{val.name}}
              &lt;/div&gt;
              &lt;br /&gt;
              &lt;div ng-repeat="(key, val) in gender"&gt;
                &lt;input type="radio" ng-model="$parent.formData.selectedGender" name="formData.selectedGender" id="{{val.id}}" value="{{val.id}}" required /&gt;{{val.name}}
              &lt;/div&gt;
              &lt;br /&gt;
            &lt;/div&gt;
            &lt;pre&gt;{{formData.selectedFruits}}&lt;/pre&gt;
            &lt;input type="submit" id="submit" value="Submit" /&gt;
          &lt;/form&gt;
        &lt;/div&gt;
        &lt;br&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the code in plunker: <a href="http://plnkr.co/edit/Bz9yhSoPYUNzFDpfASwt?p=preview">http://plnkr.co/edit/Bz9yhSoPYUNzFDpfASwt?p=preview</a> Has anyone done this on AngularJS? Making the checkboxes required, forces me to select all the checkbox values. This problem is also not documented in the AngularJS documentation.</p>