I'm confused, I have a jquery script that change the text color to red if it finds a negative number in an html table.
console.log("reading Script");
$('td:nth-child(3)').each(function() {
var txt = $(this).text();
if (txt.indexOf('-') > -1) {
$(this).css("color", "red");
console.log("True: " + txt);
} else {
$(this).css("color", "green");
console.log("False: " + txt);
}
});
This script works perfect in one example where I'm using "ng-repeat d in data" with this expression {{d.category}} but I have a second example that it's not working, I'm using the same script but the angular expression is differente bucause the JSON structurure that Im reading is different, ng-repeat="data in PostResponse.result" and my angular expression goes like this {{data.merchMetrics.category}} and here I'm getting all the values in green, even the negative numbers so I dont get it, because the first example is quite the same, the only thing that is different is the structure of the data.
Even the console log works different, in my first example logs something like this:
- True: -4
- False 10
This is ok but in the second example Im getting this in the console:
- False: {{data.merchMetrics.category}}
So, any ideas?