AngularJS之ng-hide指令
发布时间:2020-12-17 09:48:46 所属栏目:安全 来源:网络整理
导读:1、问题背景 AngularJS的ng-hide指令,当其值为true,隐藏HTML元素;当值为false,显示HTML元素 2、实现源码 !DOCTYPE htmlhtmlheadmeta charset="UTF-8"titleAngularJS之ng-hide指令/titlescript src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/
1、问题背景 AngularJS的ng-hide指令,当其值为true,隐藏HTML元素;当值为false,显示HTML元素 2、实现源码
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>AngularJS之ng-hide指令</title> <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <div ng-app="" ng-init="flag=true"> <button ng-hide="flag">查询</button><br> <input type="checkbox" ng-model="flag" />老鼠<br> <input type="radio" ng-hide="!flag" />猫<br> <label>{{flag}}</label> </div> </body> </html> 3、实现结果 (1)勾选复选框 按钮隐藏,单选框显示 (2)取消勾选复选框 按钮显示,单选框隐藏
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |