Set class in angular if variable is defined?

angularjs

Solution

You can do it easier:

 ng-class="{'expanded':  member != undefined}"

or even:

ng-class="{'expanded':  member }"

Example: http://plnkr.co/edit/9RMulfYViGKf91743VZz?p=preview

Problem

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'} ```

Original source