$scope.checkAll = function() {
if ($scope.selectedAll) {
$scope.selectedAll = true;
} else {
$scope.selectedAll = false;
}
angular.forEach($scope.MyProducts, function(item) {
item.Selected = $scope.selectedAll;
});
/*});*/
}
<div class="panel-heading col-xs-12">
<h6 class="viewStyle col-xs-4"><input type="checkbox" ng-model="selectedAll" ng-click="checkAll()" />Select All</h6>
</div>
<div id="gridView" ng-repeat="product in MyProducts">
<input style="float:left" type="checkbox" ng-model="product.Selected" ng-checked="product.Selected" value="product.ProductId" />
</div>
Utilizing two nested divs, my attempt to implement a single checkbox that would automatically select all other checkboxes has proven unsuccessful. Below is the HTML markup and associated controller code. Any guidance would be greatly appreciated.