-2

I try to build a User bar like in Facebook "New Friend Requests" ore "New Pms"

This is now my HTML Template Code:

<li class="icon-element pms">
    <div class="icon" ng-include="iconPm"></div>
    <span class="counter">{{account.newPms}}</span>
</li>

In the span is {{account.newPms}} this can be 0. If it is 0, then i want to set a class in the li namend "is-zero"

I found some in other topics like:

<li ng-if="account.newPms == '0'></li>

but how i can set the class in the li if it is 0?

best regards!

2
  • 1
    Note that because your class has a - in it, you need to put the name in quotes, which they didn't have to do in the linked question because the name was test and so they didn't need them: <li ng-class="{'is-zero': account.newPms == 0}"> See also the has-error example in the documentation. Commented Jun 23, 2016 at 15:25
  • Thanks alot for this short and exact answere! This will helps me alot. Commented Jun 23, 2016 at 15:29

1 Answer 1

-2

Try using ng-class. This allow to apply class on certain condition. For example ng-class='{"is-zero":account.newPms==0"}'

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.