I am working on a project where there is template which i am loading through a bootstrap modal in asp.net MVC in that modal there is a table which i am loading dynamically. There are checkboxes beside each record and on selection of every checkbox that data is getting selected. Now i want to add a parent checkbox on click of which i want to check all checkboxes from that table. I have written following code but not able to achieve the functionality. `
<table class="table table-condensed table-bordered table-hover left" style="width:100%;margin:0px;" <thead> <tr> <th> <input type="checkbox" style="margin: 3px 0; ng-model="selectAll" ng-click="checkAll()"> </th> <th>NAME</th> <th>CITY</th> </tr> </thead> <tr ng-repeat="clientData in Clients> <td> <input type="checkbox" style="margin: 3px 0;" ng-model="clientData.IsSelectedClients" ng-change="checkClients(clientData.IsSelectedClients); IsAllSelectedClient=false;"/> </td> <td>{{clientData.Name}}</td> <td>{{agentData.City}}</td> </tr> </table>`
Angular js code is below
$scope.checkAll = function() { angular.forEach($scope.Clients, function(client) { client.IsSelectedClients= $scope.selectAll; }); };
I am not able to find out why it is not working can anybody help me to get it working Thanks in advance