Last active
December 14, 2015 01:19
-
-
Save heckmac/5005272 to your computer and use it in GitHub Desktop.
angular switch ng-class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="" ng-click="predicate = '';reverse=false;" class="btn btn-small btn-views btn-views-left" ng-class="{active: predicate == ''}"><span class="icon-dataview"></span>DATA</a> | |
<a href="" ng-click="predicate = 'points'; reverse=true;" ng-class="{active: predicate == 'points'}"class="btn btn-small btn-views btn-views-right"><span class="icon-vote"></span>VOTI</a> | |
<!-- alternative way --> | |
<a ng-class="{admin:'enabled', moderator:'disabled', '':'hidden'}[user.role]">{{{admin:'enabled', moderator:'disabled', '':'hidden'}[user.role]}}</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment