1.ng-class指令可以设置一个键值对,用于决定是否添加一个特定的类名,键为class名,值为bool类型表示是否添加该类名
<style>
.red {
color: red;
}
.green {
color: green;
}
</style>
<!--奇偶行显示不同颜色-->
<body ng-app="myApp">
<ul ng-controller="ListController">
` <!-- ng-class="{loading:loading}" -->
<li ng-repeat="item in xiaoheishenghuo" ng-class="{red:$even,green:$odd}" data-id="{{item.id}}">
<strong>{{item.name}}</strong>
</li>
</ul>
</body>