title: Binding multiple checkboxes in angular js
body: <p>I have two arrays coming from web service of object. One is all categories and other one is selected categories like this</p>
  
  <pre><code>$scope.categories = [
      { "id": 1, "name": "cat1" },
      { "id": 2, "name": "cat2" },     
      { "id": 3, "name": "cat3" }, 
      { "id": 4, "name": "cat4" }
  ];
  
  $scope.selected_category = [
      { "id": 1, "name": "cat1" },
      { "id": 2, "name": "cat2" }
  ];
  </code></pre>
  
  <p>and my markup is like this</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label&gt;Category&lt;/label&gt;
      &lt;div class="clr"&gt;&lt;/div&gt;
      &lt;label class="checkbox-inline" ng-repeat="item in categories"&gt;
          &lt;input type="checkbox" value="{{item.id}}" ng-model="?" ng-checked="?"&gt;         
          {{item.name}}
      &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I can't figure out how do I check those checkboxes which are coming as selected. please help!</p>
  
  <p>Thanks</p>