Reputation: 629
I've just started to learn angularjs, so pardon me if this question is very basic.
I have a table which has both positive and negative numbers. I can currently use "number:0" to display no decimal numbers and include a comma as thousand separator. My questions is how do I color code the cells : red for -ive numbers and green for 0 or +ive numbers? The numbers will be dynamic and randomly +ive or -ive, single row/column could have some numbers +ive and some -ive.
Upvotes: 0
Views: 171
Reputation: 21485
There are lots of different ways to do this; one simple one is
<tr ng-class="{redRow: n < 0, greenRow: n >= 0}">...</tr>
...where n is the number you're testing against, and redRow and greenRow are (poorly-named) css classes you would define separately.
Upvotes: 3