The link to the directive code - https://gist.github.com/askeroff/fbb6...
In this video I'll teach you how to detect clicks outside in #angular. This can be useful, when you need, for example:
close a dropdown menu on a click outside
close a popup window on a click outside
And all sorts of other stuff, that might happen to be required during #webdev process.