We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a97e47 commit a53fdb0Copy full SHA for a53fdb0
lib/scripts/directive.js
@@ -36,12 +36,14 @@
36
}
37
$scope.initConfig();
38
39
- $document.on('click', function (evt) {
40
- if ($scope.find(evt.target).length === 0) {
41
- $scope.log('Color Picker: Document Click Event');
42
- $scope.hide();
43
- }
44
- });
+ $document.on('click', $scope.onClick);
+ };
+
+ $scope.onClick = function(event) {
+ if ($scope.find(event.target).length === 0) {
+ $scope.log('Color Picker: Document Click Event');
45
+ $scope.hide();
46
+ }
47
};
48
49
$scope.initConfig = function() {
@@ -418,7 +420,7 @@
418
420
$scope.init();
419
421
422
$scope.$on('$destroy', function() {
- $document.off('click');
423
+ $document.off('click', $scope.onClick);
424
});
425
426
0 commit comments