I have a dropdown menu on my site that is controlled by ng-show
. When the user clicks on a button they see the dropdown. When they click again, the dropdown is hidden:
<div class="button" ng-click="show = !show">Click Me</div>
<div ng-show="show" ng-init="show = false">
<div>You can see me now!</div>
</div>
This works fine. But, what I want is for show
to be set to false if the user clicks anywhere in the window that is not the div with class "button". How can I achieve this?