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.
2 parents c7dbddb + 45e3115 commit f9b891cCopy full SHA for f9b891c
source/directives/uiTreeNode.js
@@ -411,12 +411,19 @@
411
element.bind('touchend touchcancel mouseup',function(){$timeout.cancel(dragTimer);});
412
};
413
bindDrag();
414
-
415
- angular.element($window.document.body).bind("keydown", function(e) {
416
- if (e.keyCode == 27) {
417
- scope.$$apply = false;
418
- dragEnd(e);
419
- }
+
+ var keydownHandler = function(e) {
+ if (e.keyCode == 27) {
+ scope.$$apply = false;
+ dragEnd(e);
+ }
420
+ };
421
422
+ angular.element($window.document.body).bind("keydown", keydownHandler);
423
424
+ //unbind handler that retains scope
425
+ scope.$on('$destroy', function () {
426
+ angular.element($window.document.body).unbind("keydown", keydownHandler);
427
});
428
}
429
0 commit comments