Question

I want to set an span 2 classes and one more with conditionality if item.qty is 0. I have this

<span ng-class="glyphicon,glyphicon-minus,{'notvisible': item.qty  0}"/>

But this dont work..i think this is not the sintax but i havent found anythink.

Was it helpful?

Solution

Why don't you just add those static classes in the usual way and only leave the conditional in an ng-class, like this:

 <span class="glyphicon glyphicon-minus" ng-class="{'notvisible': item.qty==0}"/>

Also, you forgot the compare-operator == (I added it in the above example). If you only want to toggle the visibility of that element with the 'notvisible'-Class, I would even recommend you use the ng-show-Directive like this:

 <span ng-show="item.qty > 0" class="glyphicon glyphicon-minus" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top