angularjs - use of operators( >,<,==,!=) in ng-class -


i want use operators check if value greater or equal other number or variable in ng-class, , apply style class accordingly. want color div based on prob.

is usage of ng-class correct? prints value of

{{1-apstats.premappedprobability.tofixed(3)}}  

but ng-class tag doesn't work. reasons?

 <div ng-class="(1-apstats.premappedprobability.tofixed(3) >=0.5) ? 'yellowclass':'redclass'"> {{1-apstats.premappedprobability.tofixed(3)}} </div> 

what doing wrong.? thank you

@subhash

in ng-class directive, first need give class name condition following -

ng-class="{morebtngray : condition}" 

in case - should use 2 ng-class , maintain condition accordingly.

 <div ng-class="{yellowclass: condition1, redclass:condition2}">{{1-prob.p}} </div> 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -