JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<div class="body" ng-app>
<div ng-controller="ProjectCtrl">
<table id="datatable_tabletools">
<thead>
<tr>
<th><input name="all" type="checkbox" ng-click="selectAllFriends()"/></th>
<th>Project Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="project in projects">
<td>
<label class="checkbox">
<input name="all" type="checkbox" ng-model="project.checked" value="{{ project.ID }}"/><i></i>
</label>
</td>
<td title="{{project.NAME}}">{{project.NAME}}</td>
</tr>
</tbody>
</table>
<button ng-click="delete()" disabled="disabled">Delete</button>
</div>
</div>
JavaScript
function ProjectCtrl($scope,$filter) {
$scope.projects = [
{ID:1,NAME:'NAME1'},
{ID:2,NAME:'NAME2'},
{ID:3,NAME:'NAME3'}
];
$scope.$watch( "projects" , function(n,o){
var checked = $filter("filter")( n , {checked:true} );
if(checked.length){
$scope.selected = checked;
$('button').removeAttr('disabled');
}else{
$('button').attr('disabled','disabled');
}
}, true );
$scope.isAll = false;
$scope.selectAllFriends = function() {
if($scope.isAll === false) {
angular.forEach($scope.projects, function(project){
project.checked = true;
});
$scope.isAll = true;
} else {
angular.forEach($scope.projects, function(project){
project.checked = false;
});
$scope.isAll = false;
}
};
$scope.delete = function() {
console.log($scope.selected);
// How to delete rows using selected $scope.selected objects
angular.forEach($scope.projects, function (row, index) {
if($scope.projects[index].checked) {
$scope.projects.splice(index,1);
}
});
}
}