156
rated 0 times
[
160]
[
4]
/ answers: 1 / hits: 6150
/ 9 Years ago, sun, may 17, 2015, 12:00:00
I have this table showing software logs, which gets populated by JSON data:
<div ng-controller=LogCtrl>
<table id=logtable style=width:100%>
<tr>
<th>Timestamp</th>
<th>Severity</th>
<th>Message</th>
</tr>
<tr ng-repeat=log in logs class=logentry>
<td>{{log.timestamp}}</td>
<td>{{log.severity}}</td>
<td>{{log.message}}</td>
</tr>
</table>
It works fine, but I would like to be able to change each tr
element background following its severity. For example, if the severity of that log is ERROR, its entry in the table should have red background, if the severity is MESSAGE, it should be green, etc.
I already took a look at ng-style
, but I didn't find out how to use it for this purpose.
Any suggestions?
More From » html