angular學習日誌08 ng-show ng-hide

<!DOCTYPE html>
<html lang="en" ng-app="start">
<head>
<meta charset="UTF-8">
<title>ng-hide ng-show</title>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body>
<div ng-controller='DeathrayMenuController'>
<button ng-click='toggleMenu()'>Toggle Menu</button>
<ul ng-show='menuState.show'>
<li>Stun</li>
<li>Disintegrate</li>
<li>Erase from history</li>
</ul>
</div>
<script type="text/javascript">
angular.module('start',[])
.controller('DeathrayMenuController',function($scope){
$scope.menuState={
show:false
};
$scope.toggleMenu=function(){
$scope.menuState.show = !$scope.menuState.show;
}
})


</script>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章