Mixed use of regular class and ng class
Want to create different icons in ng-repeat:
<i class="fa fa-pencil"></i>
<i class="fa fa-briefcase"></i>
...
How can I specify only one of the classes with ng-class?
If I wrote:
<i class="fa" ng-class="{{t.icon}}"></i>
Then the generated output
<i class="fa" ng-class="fa-pencil"></i>
<i class="fa" ng-class="fa-briefcase"></i>
and of course, the icon does not appear on the page.
+4
1 answer
Do not use angular expression. It works:
<i class="fa" ng-class="t.icon"></i>
(See plunker with an example in the p tag: http://plnkr.co/edit/AUN81QF0COtYMeedBygJ?p=preview )
You can put various inputs in ngClass, you can see them in:
https://docs.angularjs.org/api/ng/directive/ngClass
The arguments section contains a brief description of them.
+8