有没有办法在行或列上添加类取决于值。如果列“anzahl”为空,则行背景颜色必须为“灰色”,列“anzahl”背景颜色变为“红色。
<body ng-app ng-init='articles = [
{"id":"1","name":"A&R","type":"P77 ","anzahl":"0"},
{"id":"2","name":"Accuphase","type":"AC5 ","anzahl":"1"},
{"id":"3","name":"Acoustical Systems","type":"Archon","anzahl":"1"}
]'>
<div class="container">
<table class="table">
<tr ng-repeat="article in articles">
<td>{{article.name}}</td>
<td>{{article.type}}</td>
<td>{{article.anzahl}}</td>
</tr>
</table>
</div>
</body>