angular.js ng-class-even ng-class-odd ng-cloak(没啥技术含量)

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.even{
color: red;
}
.odd{
color: blue;
}
</style>
</head>
<body ng-app="app">
<ul ng-controller="people">
<li ng-repeat="person in persons" ng-class-even="'even'" ng-class-odd="'odd'">
{{person}}
</li>
</ul>
<script src="js/angular.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var app = angular.module('app' , []);
app.controller('people' , ['$scope' , function($scope){
$scope.persons = ['xudy' , 'lpf' , 'laogong' , 'laopo'];
}]);
</script>
</body>
</html>

顺便说一下 ng-cloak就是在页面加载的时候,页面会显示{{}}这样的angular的表达式,为了在页面加载的时候不出现{{}}所以在指定的标签加上ng-cloak是非常必要的,但是angular.js不能放在最后面了,得放在head标签里面

上一篇:java关键字保留字


下一篇:VS2008打上SP1的补丁后安装了silverlight后出现未将对象引用设置到对象实例的解决办法