我在表格中有以下ng-repeat;
<tbody>
<tr ng-repeat="hour in workhours">
<td >{{hour}}:00 - {{hour+1}}:00</td>
<td ng-class="{'full' : }" ng-click="checkSlotAvailability(hour, entry, jobLength, data)" ng-repeat="entry in data.calendar" >
{{entry.HoursAvailable.includes(hour) ? 'AVAILABLE' : 'FULL'}}
</td>
</tr>
</tbody>
.full{
background-color: red;
}
我希望表格单元格在单元格上有“FULL”文本时显示红色。与'full'
中ng-class
配对的内容是什么?
答案 0 :(得分:2)
尝试使用否定运算符。仅当.full
为false(要显示FULL文本的条件)时,您才希望应用entry.HoursAvailable.includes(hour)
类
ng-class="{'full' :!entry.HoursAvailable.includes(hour) }"