title: Data Binding ionic checkbox in controller not working
body: <p>Is my firts time working with ionic and angular. I have a checkbox list populate from controller, when I click on check the view show my change but if I want view this change on controller show me the old value. I need add/substract the values</p>
  
  <p>html</p>
  
  <pre><code>   &lt;div class="item-text-wrap"&gt;
       &lt;ion-list&gt;
           &lt;ion-checkbox ng-repeat="item in listTypeProduct"
           ng-model="item.checked" 
           ng-checked="item.checked"
           ng-change="add(listTypeProduct)" &gt;{{ item.text }}
      &lt;/ion-checkbox&gt;
  
        &lt;/ion-list&gt;
      &lt;/div&gt;
  
      &lt;div class="item"&gt;
        &lt;pre ng-bind="listTypeProduct | json"&gt;&lt;/pre&gt; 
      &lt;/div&gt;
  </code></pre>
  
  <p>the print on page is working!</p>
  
  <p><a href="https://i.stack.imgur.com/3ffuo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3ffuo.png" alt="when I click on check the binding working"></a> </p>
  
  <p>This is my controller</p>
  
  <pre><code> app.controller('CotCtrl', function($scope, $ionicSideMenuDelegate,$rootScope) {
  
  $scope.listTypeProduct = [
           { text: "a1",    checked: false , value:4500 },
           { text: "a2",  checked: false , value:2000 },
           { text: "a3", checked: false , value:1200 }
  ];
  
  $scope.add = function(list){
      console.log(JSON.stringify(list));
  }; 
  </code></pre>
  
  <p>But on my controller when I iterate the array give me the old information.</p>
  
  <p><a href="https://i.stack.imgur.com/9uMyX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9uMyX.png" alt="enter image description here"></a></p>
  
  <p>Method "add" I want iterate the list with update values for example</p>
  
  <pre><code>angular.forEach(list, function(val, key) {
   if( checked &amp;&amp; (value) )
     $scope.total += total+val.value;
   });
  </code></pre>
  
  <p>To add all  checked values.</p>