title: AngularJS ng-checked not updating with model
body: <p>On my page I have brand A and Brand B. By clicking on one, I display a filtered list of address types, and clicking on one of those then filters locations.</p>
  
  <p>When I click on brand A, I save an object of the checked items and overwrite with brand B's list. When I click back to Brand A, the location list is filtered correctly, but the address types are not being checked, even though they exists in the array.</p>
  
  <p>FYI, md-checkbox is an Angular Material checkbox.</p>
  
  <p>Here is my HTML:</p>
  
  <pre><code>&lt;ul &gt;
      &lt;li id="brandA" ng-click="setBrand(0)" ng-class="{'brandSelected': brand == 0}"&gt;
          &lt;/span&gt;Brand A&lt;/span&gt;
  
      &lt;/li&gt;
  
      &lt;li id="brandB" ng-click="setBrand(1)" ng-class="{'brandSelected': brand == 1}"&gt;
          &lt;/span&gt;Brand B&lt;/span&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;div ng-repeat="item in addressTypes | filter : filterAddressTypeByBrand"&gt;
      &lt;md-checkbox class="md-primary" ng-checked="exists(item)" ng-click="toggle(item)" ng-model="item.selected"&gt;
      {{ item.desc }}
      &lt;/md-checkbox&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is an extract of my controller:</p>
  
  <pre><code>$scope.addressTypesSelected = [];
  $scope.addressTypesSelectedBrandA = [];
  $scope.addressTypesSelectedBrandB = [];
  
  
  $scope.toggle = function (item) {
      var idx = $scope.addressTypesSelected.indexOf(item);
      if (idx &gt; -1) $scope.addressTypesSelected.splice(idx, 1);
      else $scope.addressTypesSelected.push(item);
  };
  $scope.exists = function (item) {
      return $scope.addressTypesSelected.indexOf(item) &gt; -1;
  };
  
  
  $scope.setBrand = function (val) {
      $scope.brand = val;
      $scope.addressTypesSelected = [];
  
      if ($scope.brand == 1) {
          $scope.addressTypesSelectedBrandB = [];
          $scope.addressTypesSelectedBrandB = angular.copy($scope.addressTypesSelected);
  
          $scope.addressTypesSelected = angular.copy($scope.addressTypesSelectedBrandA);
      } else {
          $scope.addressTypesSelectedBrandA = [];
          $scope.addressTypesSelectedBrandA = angular.copy($scope.addressTypesSelected);
  
          $scope.addressTypesSelected = angular.copy($scope.addressTypesSelectedBrandB);
      }
  
      $scope.filterDealers($scope.dealers);
  }
  </code></pre>
  
  <p>What needs to be done to get the checkboxes checked when switching between brands?</p>
  
  <p>UPDATE 1.</p>
  
  <p>I've added ng-model="item.selected" to md-checkbox. This seemed to do the trick. However, if I check a box on Brand A, then click on Brand B, then click Brand A, the checkbox remains checked. If I continue and click on Brand B then click again on Brand A, the checkbox is unchecked, yet the value in the model is set to true.</p>