title: How to add checkbox values to an array in AngularJS?
body: <p>Someone help me please!
  Lets say I have an a list of a checkboxes, each checkbox have an ID.
  I would like to $scope an array with checked checkboxes IDs.</p>
  
  <pre><code>&lt;div ng-app="myapp"&gt;
  &lt;div ng-controller="ctrlParent"&gt;
      &lt;table&gt;           
      &lt;tr ng-repeat="(key, value) in providers"&gt;
          &lt;td&gt;&lt;input type="checkbox" ng-model="ids[value.Id]"&gt;  {{value}} &lt;/td&gt;
      &lt;/tr&gt;            
      &lt;/table&gt;
      {{ids}}
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>And my controller:</p>
  
  <pre><code>var app = angular.module('myapp',[]);
  
  app.controller('ctrlParent',function($scope){
      $scope.providers = [{Id:5},{Id:6},{Id:8},{Id:10}];
      $scope.ids = {};
  });
  </code></pre>
  
  <p>Now my array output (if all check boxes are checked) is: {"5":true,"6":true,"8":true,"10":true} </p>
  
  <p>And I would like: [{Id:5},{Id:6},{Id:8},{Id:10}]</p>