I cannot get ng-class working when the class I am adding has a hyphen in it .
angularjs
Solution
Surround class name with singe quotation.
data-ng-class="{'fa-spin': fetching.length > 0}"
Otherwise angular search your scope for `fa-spin` which is not a valid name for variables.
Problem
I am trying to add a class to my element in Angular. Here's my code: ``` <button class="medium" data-ng-disabled="!gridForm.$pristine || fetching.length != 0" data-ng-click="getQuestions()"> Retrieve<span class="fa fa-spinner fa-fw mlr75" data-ng-class="{fa-spin: fetching.length > 0}"> </span> </button> ``` However it's giving me a strange error: ``` Syntax Error error in component $parse Syntax Error: Token '-' is at column {2} of the expression [{3}] starting at [{4}]. ``` Does anyone have any ideas as to what might be wrong? Note that it works when I use the class faspin without the hyphen !!