I hope this saves someone a headache with styles that use dashes, especially since bootstrap has become so popular.
I am using angular 1.0.5 by way of
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js"></script>
In the ngClass documentation, the example is simple, but it also mentions the expression can be a map of class names to boolean values. I was trying to use the "icon-white" style on my icon as shown in the bootstrap documentation, depending on a boolean variable.
<i class="icon-home" ng-class="{icon-white: someBooleanValue}">
The line above does not work. The class is not appended with icon-white
when someBooleanValue
is true. However, if I change the key to iconWhite
, it is successfully added to the list of class values. How would one add a value with a dash?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…