前端之家收集整理的这篇文章主要介绍了
angularjs之checkbox全选,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="kongwc" ng-controller="myCtrl">
<table border="1" width="500" align="center">
<tr>
<td><input type="checkBox" ng-model="all"/><span>{{all?'取消':'全选'}}</span></td>
<td>姓名</td>
<td>性别</td>
</tr>
<tr ng-repeat="student in students">
<td><input type="checkBox" ng-checked="all"/></td>
<td>{{student.name}}</td>
<td>{{student.value}}</td>
</tr>
</table>
<script>
var app = angular.module("kongwc",[]);
app.controller("myCtrl",function ($scope) {
$scope.students = [
{name:'小白牛',value :'男'},{name:'迷迭香',value:'女'},{name:'末日使者',value:'男'},{name:'黑暗游侠',value:'女'}
];
$scope.repeatData = ['小白牛','迷迭香','小白牛'];
});
</script>
</body>
</html>