Reputation: 15036
I'm trying to set the class "expanded" to a div if the variable is undefined. I attempted this, but had no success. What am I doing wrong?
{'expanded': typeof member != 'undefined'}
Upvotes: 5
Views: 9564
Reputation: 1336
Place your condition inside a function in the scope.
Plunkr: http://plnkr.co/edit/JnH0H7
Upvotes: 2
Reputation: 42196
You can do it easier:
ng-class="{'expanded': member != undefined}"
or even:
ng-class="{'expanded': member }"
Example: http://plnkr.co/edit/9RMulfYViGKf91743VZz?p=preview
Upvotes: 11