<!doctype html>
<html lang="en" ng-app="myAPP">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></script>
</head>
<body>
<div ng-controller="toggleController">
<button ng-click="toggle()">點擊</button>
<ul ng-show="menuState">
<li ng-repeat="Cateroy in Cateroyes">
<a href="{{Cateroy.id}}">id:{{Cateroy.id}} 欄目:{{Cateroy.name}}</a>
</li>
</ul>
</div>
<script>
var Cateroyes=[
{"id":"1","name":"特色"},
{"id":"2","name":"簡介"},
{"id":"3","name":"聯繫"},
{"id":"4","name":"文化"},
];
var myAPP=angular.module('myAPP',[]);
myAPP.controller('toggleController',function($scope){
$scope.menuState=false;
$scope.Cateroyes=Cateroyes;
$scope.toggle=function(){
$scope.menuState=!$scope.menuState;
}
});
</script>
</body>
</html>
ng-repeate 和ng-show的用法
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.