1、列表隐藏/显示
<span ng-click="showList = !showList">应用列表</span>
<ul ng-show="showList" class="sub-list">
<li>aa</li>
<li>aa</li>
<li>aa</li>
</ul>
</span>
在线运行
2、标签切换
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<title>ng-show and ng-hide directives</title>
<script src="https://www.orchome.com/user/js/angular-1.5.8.min.js"></script>
</head>
<body>
<div ng-controller="VisibleController">
<p ng-show="visible">字符串1</p>
<p ng-hide="visible">字符串2</p>
<button ng-click="toggle()">切换</button>
</div>
<script type="text/javascript">
var app = angular.module('app',[]);
app.controller('VisibleController', function($scope){
$scope.visible = false;
$scope.toggle = function () {
$scope.visible = !$scope.visible;
}
});
</script>
</body>
</html>
在线运行