I am displaying dropdown menu when I click on an item. It is hiding when I click again on the item. I am trying to hide the dropdown menu if I click anywhere on the window. Here is my code.
<div ng-click="showDropDown()" class="dropdown">dropDown
<div id="myDropdown" class="dropdown-content">
<label ng-click="sentToHome()">Home</label>
<label ng-click="sentToContacts()">Contacts</label>
</div>
</div>
Here is my controller:
$scope.showDropDown = function(){
document.getElementById("myDropdown").classList.toggle("show");
};
How to close the dropdown if I click anywhere in the page?