title: How to bind ng-model to ng-checked boxes
body: <p>I am having a problem binding Angular ng-check to ng-model, that is ng-model does do not recognize the selected state of my check boxes.</p>
  
  <p>Here is a description(Its a much larger code base but I have tailored to minimize code).</p>
  
  <p>On page load in JavaScript I initialize my products and set the default values:</p>
  
  <pre><code>$scope.products = {}
  $scope.SetProductsData = function() {
      var allProducts;
      allProducts = [
        {
          id: 1,
          name: "Book",
          selected: true
        }, {
          id: 2,
          name: "Toy",
          selected: true
        }, {
          id: 3,
          name: "Phone",
          selected: true
        }]
  </code></pre>
  
  <p>I have a master control in my view that list a check box  for each 3 products(Book,Toy and phone):These are checked by default</p>
  
  <pre><code>&lt;div style="float:left" ng-init="allProducts.products = {}" &gt;
      &lt;div ng-repeat="p in Data.products"&gt;
          &lt;div style="font-size: smaller"&gt;
              &lt;label&gt;&lt;input id="divPlatorm"  ng-model="products[p.name]" ng-init="products[p.name] = true" type="checkbox"/&gt;
                  {{p.name}}&lt;/label&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Then a table that have the same products repeated in rows:</p>
  
  <pre><code>&lt;div ng-repeat="line in lineProducts" ng-init="line.products = {}"&gt;
      &lt;div id="sc-p-enc" ng-repeat="p in Data.products"&gt;
          &lt;div id="sc-p-plat" style="font-size: smaller"&gt;
              &lt;label id="pl-label"&gt;&lt;input ng-checked="products[p.name]"  ng-model="line.products[p.name]"  ng-init="line.products[p.name] = true" type="checkbox"/&gt;                                    
                  {{p.name}}&lt;/label&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I check/unchecked the master products the corresponding check boxes changes in the rows. So if I have 100 rows with   (Book,Toy and phone) the unchecked Toy I can see where all toys are unchecked in the rows.</p>
  
  <p>When I send the data to my controller I can still see all Toys = true even though they were unchecked.</p>
  
  <p>If I physically go to the row then unchecked each toy and send the data to my controller Toys = False.</p>
  
  <p>How can I get the check boxes selected state to change when controlled from the master check-boxes?</p>
  
  <p>I have followed the post found here but I dont think this applies to my scenario:
  <a href="https://stackoverflow.com/questions/16601018/angularjs-ng-model-not-binding-to-ng-checked-for-checkboxes">AngularJS: ng-model not binding to ng-checked for checkboxes</a></p>