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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -