testShowAndHiddern.html
<!DOCTYPE html>
<html ng-app="MyModule">
<head>
<meta charset="UTF-8" />
<title>动画效果之:隐藏与显示</title>
<!--引入官方标准的angular.min.js -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<script src=" js/dynamic/testShowAndHidden.js"></script>
</head>
<body >
<div ng-controller="TextShowAndHiddenController">
<button ng-click="showAhidden()">{{title}}</button >
<ul ng-show="status.show">
<li></li>
<li></li>
<li></li>
</ul>
</div>
</body>
</html>
/test/WebContent/js/dynamic/testShowAndHidden.js
var myModule=angular.module("MyModule", []);
myModule.controller("TextShowAndHiddenController",['$scope',
function HelloController($scope){
//初始化默认值
$scope.title="动画效果之:隐藏与显示...";
//默认隐藏
$scope.status={
show:false
};
//单击事件后:显示或隐藏
$scope.showAhidden=function(){
$scope.status.show= !$scope.status.show;
}
}
]);
访问路径:http://localhost:8080/test/testShowAndHiddern.html
访问效果: