title: Get the value of all checkbox when checkall checkbox is checked
body: <p><a href="https://i.stack.imgur.com/eH1Y6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eH1Y6.png" alt="pic"></a>
  I'am new to angularjs, I'm creating an application of attendance. When i check the checkall checkbox all the checkbox of name is also check and What i really wanted to achieve is to get the value of checked checkboxes. I'm done with checking all checkboxes. I just want to store all the value of checkboxes in an array. I can only get data when i check those checkboxes one by one. Thank you in advance.</p>
  
  <p>In my html here is my code. </p>
  
  <pre><code>         &lt;ion-checkbox ng-model="Selected" ng-click="checkAll()"&gt;
           &lt;div class="wew"&gt;
           Check All Checkbox
           &lt;/div&gt;&lt;/ion-checkbox&gt;
           &lt;/label&gt;&lt;/div&gt;
           &lt;table&gt;&lt;tr&gt;&lt;th&gt;&lt;center&gt;
           List of Names
           &lt;/center&gt;&lt;/th&gt;
           &lt;th colspan="3"&gt;
           Actions
          &lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;label&gt;
          &lt;ion-checkbox ng-repeat="role in roles" ng-model="isChecked" ng- 
           change="format(isChecked,role,$index)"&gt;&lt;div class="wew"&gt;
           {{role}}
           &lt;/div&gt;&lt;/ion-checkbox&gt;
           &lt;/label&gt;&lt;/td&gt;
  </code></pre>
  
  <p>And in my controllers code. First this is my code where i get the list of names.</p>
  
  <pre><code>         $http.post(link1, {section: section}).success(function(attendance){
           for(a = 0; a&lt;attendance.length; a++){
            $scope.roles = [
            attendance[0].Full_Name,
            attendance[1].Full_Name,
            attendance[2].Full_Name,
            attendance[3].Full_Name,
            attendance[4].Full_Name,
            attendance[5].Full_Name,
            attendance[6].Full_Name,
            attendance[7].Full_Name,
            attendance[8].Full_Name,
            attendance[9].Full_Name,
            ]
            }
            })
            .error(function(err) {
           console.log(err)
            })
  </code></pre>
  
  <p>And this is my code where i wanted to execute the checkall and automatically store the data in $scope.selected = []; if i click the check all checkbox..</p>
  
  <pre><code>      $scope.checkAll = function () {
        if ($scope.Selected) {
          $scope.Selected = false;
         } else {
          $scope.Selected = true;
          }
         $scope.isChecked= $scope.Selected;
  
  
        $scope.selected = [];
         $scope.format = function (isChecked, role, $index) {
          if (isChecked == true) {
           $scope.selected.push(role);
           }
          else {
          var _index = $scope.selected.indexOf(role);
          $scope.selected.splice(_index, 1);
          }
          var students = $scope.selected;
          console.log(students);
          }
          }
  </code></pre>