Skip to content

Commit 9daf019

Browse files
author
Niels Dequeker
committed
Generated new build
1 parent 2e688e3 commit 9daf019

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

dist/angular-ui-tree.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -923,12 +923,19 @@
923923
element.bind('touchend touchcancel mouseup',function(){$timeout.cancel(dragTimer);});
924924
};
925925
bindDrag();
926-
927-
angular.element($window.document.body).bind("keydown", function(e) {
928-
if (e.keyCode == 27) {
929-
scope.$$apply = false;
930-
dragEnd(e);
931-
}
926+
927+
var keydownHandler = function(e) {
928+
if (e.keyCode == 27) {
929+
scope.$$apply = false;
930+
dragEnd(e);
931+
}
932+
};
933+
934+
angular.element($window.document.body).bind("keydown", keydownHandler);
935+
936+
//unbind handler that retains scope
937+
scope.$on('$destroy', function () {
938+
angular.element($window.document.body).unbind("keydown", keydownHandler);
932939
});
933940
}
934941
};

0 commit comments

Comments
 (0)