加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs之checkbox全选

发布时间:2020-12-17 09:11:55 所属栏目:安全 来源:网络整理
导读:!DOCTYPE htmlhtmlhead meta charset="utf-8" script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"/script/headbody ng-app="kongwc" ng-controller="myCtrl" table border="1" width="500" align="center" tr tdinput type="c
<!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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读