I have a angular controller which needs to reset whenever the user clicks outside the scope of the controller. How do I do this?
Sample html:
<div id='parent'>
<div id='1' ng-controller="ctrl1">
<!--other things-->
</div>
<div id='2' ng-controller="ctrl2">
<!--other things-->
</div>
</div>
<div id="parent2">
<!--other things-->
</div>
I want to be able to reset ctrl2 if a click occurs outside of ctr2
when the click occurs outside of div2
ctr2 has a reset function defined inside