[angularjs] How to show/hide if variable is null

I'm wanting to show/hide a div based on whether a variable is null or not.

<div ng-show="myvar"></div>

Note: the variable in my case is an object.

A very simple question, but I can't seem to make it work.

Thanks.

This question is related to angularjs

The answer is


In this case, myvar should be a boolean value. If this variable is true, it will show the div, if it's false.. It will hide.

Check this out.


<div ng-hide="myvar == null"></div>

or

<div ng-show="myvar != null"></div>