I've created a cool select box in Angularjs , all the codes works fine with no problem , the only problem that I'm facing with no luck to solve it is this :
Let say below is my select box markup :
<div id="selectBoxContainer" ng-click="isOpen=!isOpen">
<span>Title</span>
<input type="text" ng-model="q">
</div>
<ul id ="selectboxResult" ng-show="isOpen">
<li ng-repeat="r in result">{{r}}</li>
</ul>
So far it works and and when I click on this div or any child of it ( lets say that title element) , the ul will toggle show and hide.
Problem :
When I click outside of this div ( anywhere outside ) I want this select box to be closed ( isOpen=false) , I know that I have to catch the document.click event and do something with that , but I'm not sure how to use it.