I have a list of icons that are either "on" or "off" depending on the logical values โโin the $ area. I created two CSS classes - clrOn and clrOff - and these are just different colors. I assign all the clrOff icons with class = "and then try to override this with ng-class =" "if the boolean value is true.
Based on my research, this is what I have, which should work. plunker
CSS FILE:
.clrOn { color: #333333; } .clrOff { color: #DDDDDD; }
JS FILE:
var app = angular.module('plunker', []); app.controller('MainCtrl', function($scope) { $scope.attachments = 1; });
HTML:
<body ng-controller="MainCtrl"> <span class="clrOff" tooltip="Attachments" ng-class="{ 'clrOn' : app.attachments }"> TEST </span> </body>
source share