Reputation:
I'm using this code:
data-ng-class="{'fa-code': modal.wmdPreview == true, 'fa-laptop': modal.wmdPreview == false}"></span>
Is there a way that I could simplify this with some sort of true / false check ?
Upvotes: 0
Views: 37
Reputation: 7279
ng-class="{fa-code: modalwmdPreview, fa-laptop: !modalwmdPreview}"
or
ng-class="{true:'fa-code', false:'fa-laptop'}[modalwmdPreview]"
Upvotes: 1