I would suggest:
<span ng-class="{3:'text-danger', 2:'text-warn', 1:'text-primary',
0:'text-success'}[itemStatus.DemandLevel]">{{itemStatus.
DemandLevel|demandlevel}}</span>
Easier to read
Op donderdag 24 juli 2014 13:45:16 UTC+2 schreef Naveen Kohli:
>
> Here is an example along the same line that you can use.
>
> <span ng-class="{'text-danger':itemStatus.DemandLevel==3,
> 'text-warn':itemStatus.DemandLevel==2,
> 'text-primary':itemStatus.DemandLevel==1,
> 'text-success':itemStatus.DemandLevel==0}">
> {{itemStatus.DemandLevel|demandlevel}}</span>
>
> Notice that CSS class is different depending on value of
> "itemStatus.DemanLevel". In your case that will be "id" as you mentioned.
>
>
> On Thursday, July 24, 2014 5:41:32 AM UTC-4, lipdjo wrote:
>>
>> Hi,
>>
>>
>> Please I need some help.I'm a new angularjs programmer.My problem is the
>> following :
>>
>> I have 2 pages :
>>
>> - aaa.php with a javascript variable *var *thats changes dynamically
>> (it comes from a query in a mysql database + a conversion from php to
>> javascript).
>>
>> - bbb.html with a table (4 rows and 4 columns).there is a particular case
>> in the table with the id : <tr id="dynamic"> .
>>
>> I would like to dynamically modify the color of this particular case with
>> respect to the value of the variable *var* ?
>>
>> For example :
>>
>> if var = 1 , the case has to be red (background-color = "red").
>> if var = 2 , the case has to change dynamically and becomes green
>> (background-color = "green").
>>
>> I know , my english is terrible. :)
>>
>>
>>
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.