Monochromie Monochromie - 4 months ago 8
AngularJS Question

How to set dynamic class name with complex statement in ng-class?

That's what I have:

ng-class="[{loading:loadingIsOn},{ color:true}]"

I have problem with color variable. It holds string value of defined color, but I can not pass it to HTML.

By the way,


works fine.


If loadingIsOn is true, and color is 'green', and you want class="loading, green", then all you need is

ng-class="[{loading:loadingIsOn}, color]"