Sha256: 5aa0dc079c97ac9a9c199defa403fd0fdd230f3129f01ca23422f5f12ada8c94
Contents?: true
Size: 723 Bytes
Versions: 30
Compression:
Stored size: 723 Bytes
Contents
angular.module("oxymoron.directives.clickOutside", []) .directive('clickOutside', ['$document', function ($document) { return { restrict: 'A', scope: { clickOutside: '&', clickOutsideIf: '=' }, link: function (scope, el, attr) { var handler = function (e) { if (scope.clickOutsideIf && el !== e.target && !el[0].contains(e.target) && document.body.contains(e.target)) { scope.$apply(function () { scope.$eval(scope.clickOutside); }); } } $document.bind('click', handler); scope.$on('$destroy', function () { $document.unbind('click', handler) }) } } }])
Version data entries
30 entries across 30 versions & 1 rubygems