Inline ng-if with fa icon

What's the best way to embed ng-if?

<h3 ng-if="!ctrl.isSearchBoxCollapsed" class="box-title"><i class="fa fa-minus-circle"></i></h3>
<h3 ng-if="ctrl.isSearchBoxCollapsed" class="box-title"><i class="fa fa-plus-circle"></i></h3>

      

Hello and thank you

+3


source to share


1 answer


You can use ng-class like this:

<h3 class="box-title"><i class="fa" ng-class="ctrl.isSearchBoxCollapsed ? 'fa-plus-circle' : 'fa-minus-circle'"></i></h3>

      



I also suggest you take a look at this one , which explains many of the ways to useng-class

+2


source







All Articles