json - Best way to change color of a text depending on a value of another string using angular -
i'm using angular js , have problem , have tried many ways , googled related can't work. i'm displaying "name" , "status" in table come json file. want change color of "name" depending on number (string) in "status" column. if "status" -1 "name" should red. best way this. i'm guessing should done inside controller i'm getting json.
use ng-class it.
for example:
<div ng-repeat="item in array" ng-class="{redclass : item.status == -1}"> {{item.name}} </div> .redclass { color: red }
this working jsfiddle example.
also please see more ngclass.
Comments
Post a Comment