var app = angular.module('plunker', []);
app.controller('MainCtrl',
function MainCtrl($scope) {
$scope.rows = [{
name: "abc1",
empid: 10215,
cols: ["heading1", "heading2", "heading3"]
}, {
name: "abc2",
empid: 10216,
cols: ["heading1", "heading2", "heading3"]
}, {
name: "abc3",
empid: 10217,
cols: ["heading1", "heading2", "heading3"]
}, {
name: "abc4",
empid: 10218,
cols: ["heading1", "heading2", "heading3"]
}, {
name: "abc5",
empid: 10219,
cols: ["heading1", "heading2", "heading3"]
}];
}
);
.tdhead {
background-color: red;
}
<script data-require="[email protected]" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"></script>
<table ng-app="plunker" ng-controller="MainCtrl">
<tr ng-repeat="row in rows track by $index">
<td ng-class="{ 'tdhead' : $index == 1 && $parent.$index == 3 }" ng-repeat="col in row.cols">{{col}}</td>
</tr>
</table>
に条件の下に追加役立ちますこの値を動的にする –