AngularJS之ng-hide指令

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)取消勾选复选框

        按钮显示,单选框隐藏

       

原文地址:https://www.cnblogs.com/hzcya1995/p/13314010.html