angularjs - mix use of regular class and ng-class -
want generate different icons in ng-repeat
:
<i class="fa fa-pencil"></i> <i class="fa fa-briefcase"></i> ...
how can specify 1 of classes using ng-class
?
if wrote:
<i class="fa" ng-class="{{t.icon}}"></i>
then generated output is
<i class="fa" ng-class="fa-pencil"></i> <i class="fa" ng-class="fa-briefcase"></i>
and of course icon not show on page.
don't use angular expression. works:
<i class="fa" ng-class="t.icon"></i>
(see plunker example on p tag: http://plnkr.co/edit/aun81qf0cotymeedbygj?p=preview )
you can put various inputs in ngclass, can see them in:
https://docs.angularjs.org/api/ng/directive/ngclass
the arguments section has brief description them.
Comments
Post a Comment