Answer the question
In order to leave comments, you need to log in
Set keyKode on window angularjs?
// пример на jquery
$(window).keydown(function(e){
if(e.keyCode == 27){ // esc
// Какое-то событие
}
});
; Answer the question
In order to leave comments, you need to log in
var watcher = $scope.$watch('showFon', function (prev, new) {
if(new === true) {
angular.element($window).bind('keydown', function () {
//do something
});
} else { //dispatch keydown on window}
})
$scope.$on('$destroy', function () { watcher(); })
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question