4

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.

1 Answer 1

9

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" />
1
  • With the ng-class of first example works fine. I cant use ng-show because i want to set visibility:hidden for keep the space.. With ng-show it eat the space.
    – colymore
    Commented Mar 19, 2014 at 12:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.