title: How to check/uncheck all other checkboxes using one checkbox in angularjs?
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$scope.checkAll = function() {
    if ($scope.selectedAll) {
      $scope.selectedAll = true;
    } else {
      $scope.selectedAll = false;
    }
  
    angular.forEach($scope.MyProducts, function(item) {
      item.Selected = $scope.selectedAll;
    });
    /*});*/
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="panel-heading col-xs-12"&gt;
    &lt;h6 class="viewStyle col-xs-4"&gt;&lt;input type="checkbox" ng-model="selectedAll" ng-click="checkAll()" /&gt;Select All&lt;/h6&gt;
  &lt;/div&gt;
  
  &lt;div id="gridView" ng-repeat="product in MyProducts"&gt;
  
    &lt;input style="float:left" type="checkbox" ng-model="product.Selected" ng-checked="product.Selected" value="product.ProductId" /&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>As I'm using two divs Since I'm trying to use one checkbox which automatically check all other checkbox but I'm unable to do so I have shared html and my controller code, please help.</p>