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