I want to dynamically add a css class to an <li>
element I am looping over.
The loop is like this:
<li ng-repeat="todo in todos" ng-class="{{todo.priority}}">
<a href="#/todos/{{todo.id}}">{{todo.title}}</a>
<p>{{todo.description}}</p>
</li>
In my todo model, I have the property priority which can be "urgent", "not-so-important" or "normal" and I just want to assign the class for each element.
I know I can do this for a boolean with something like ng-class="{'urgent': todo.urgent}"
But my variable is not a boolean, but has three values.
How would I do this?
Note also that I do not want to use ng-style="..."
since my class will alter several visual things.