直接上代码
1 <!DOCTYPE html> 2 <html ng-app="myApp" > 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 <link rel="stylesheet" href="css/bootstrap.css" /> 7 <script src="js/jquery-1.11.3.min.js"></script> 8 <script src="js/angular.js"></script> 9 </head> 10 <body> 11 <div ng-controller="myCtrl"> 12 <table class="table table-bordered"> 13 <tr> 14 <td>多选</td> 15 <td>商品名称</td> 16 <td>商品数量</td> 17 </tr> 18 <tr> 19 <td><input type="checkbox" ng-checked="master"/></td> 20 <td>百事可乐</td> 21 <td>100</td> 22 </tr> 23 <tr> 24 25 <td><input type="checkbox" ng-checked="master" /></td> 26 <td>果粒橙</td> 27 <td>4000</td> 28 </tr> 29 <tr> 30 <td colspan="3" > 31 <input type="checkbox" ng-model="master"/>全选/取消 32 <!--<span ng-show="master"><input type="checkbox" ng-model="master"/>全不选</span>--> 33 <!--<span ng-hide="master" ><input type="checkbox" ng-model="master"/>全选</span>--> 34 </td> 35 36 </tr> 37 </table> 38 </div> 39 <script> 40 angular.module('myApp',['ng']).controller('myCtrl',function($scope){ 41 $scope.master=true; 42 }) 43 44 </body> 45 </html>