在ng-repeat时,对于不同状态的表格,会有显示不同颜色的需求,使用ng-style即可,具体操作如下:
<td ng-style="{'color':room.State == '在线' ?'green':''}">{{room.State}}</td>
在这里要注意的是:
- ng-style的内容要用{}包围着
- color等属性要加单引号‘’
- 属性值也要加单引号‘’
在ng-repeat时,对于不同状态的表格,会有显示不同颜色的需求,使用ng-style即可,具体操作如下:
<td ng-style="{'color':room.State == '在线' ?'green':''}">{{room.State}}</td>
在这里要注意的是: