I am trying to select all checkboxes with one single checkbox. But how to do that?
This is my HTML:
Here is a JSFiddle you can use ng-checked with a variable on it like user.checked (or use the user.select as you want)
{{user.id}}
{{user.name}}
{{user.select}}
JS:
var app = angular.module("app", []);
app.controller('dummy', function($scope) {
$scope.users = [{
id: 1,
name: "Hello",
select: 1
}, {
id: 2,
name: "World",
select: 1
}, ];
$scope.checkAll = function() {
angular.forEach($scope.users, function(user) {
user.checked = 1;
});
}
});