I have successfully created a popup box using angular in my project. It appears when I click on an icon and disappears when I click on the close button. However, I would like it to also close if someone clicks outside of the popup. Can anyone help me with this? Thank you in advance. html code
<p ng-click="openPopUP()">openPopUp</p>
<div ng-show="popup">
<p>hello</p>
<p ng-click="closePopUp()">Close</p>
</div>
JavaScript
$scope.openPopUP = function(){
$scope.popup = true;
}
$scope.closePopUp= function(){
$scope.popup = false;
}
I am looking for a way to automatically close the popup if someone clicks outside of the div.