Skip to content

Instantly share code, notes, and snippets.

View storuky's full-sized avatar

Kononenko Pavel storuky

View GitHub Profile
app.directive('clickOutside', ['$document', function ($document) {
return {
restrict: 'A',
scope: {
clickOutside: '&'
},
link: function (scope, el, attr) {
var handler = function (e) {
if (el !== e.target && !el[0].contains(e.target) && document.body.contains(e.target)) {
scope.$apply(function () {