示例
下例演示了为每个其他(奇数)个表行设置class="striped":
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>欢迎来到菜鸟教程</title>
<script src="//cdn.bootcss.com/angular.js/1.5.8/angular.min.js"></script>
<style>
.striped {
color:white;
background-color:#f0f;
}
</style>
</head>
<body ng-app="myApp">
<table ng-controller="myCtrl">
<tr ng-repeat="x in records" ng-class-odd="'striped'">
<td>{{x.Name}}</td>
<td>{{x.Country}}</td>
</tr>
</table>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.records = [
{
"Name" : "小明明",
"Country" : "北京"
},
{
"Name" : "Berglunds",
"Country" : "巴黎"
},
{
"Name" : "小猫",
"Country" : "成都"
},
{
"Name" : "Handel",
"Country" : "西班牙"
}
]
});
</script>
</body>
</html>
尝试一下