mirror of
https://github.com/mathew-kurian/Scribe.js
synced 2025-04-24 22:34:58 +00:00
Listen on keydown in app.run() in order to avoid $digest repetitions
This commit is contained in:
parent
830ffa134e
commit
a23fb326d6
2 changed files with 7 additions and 5 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body ng-keydown="onKeyDown">
|
<body>
|
||||||
|
|
||||||
<header class="header">
|
<header class="header">
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,9 @@
|
||||||
'$location',
|
'$location',
|
||||||
'$q',
|
'$q',
|
||||||
'$window',
|
'$window',
|
||||||
|
'$document',
|
||||||
'ScribeAPI',
|
'ScribeAPI',
|
||||||
function ($rootScope, $location, $q, $window, ScribeAPI) {
|
function ($rootScope, $location, $q, $window, $document, ScribeAPI) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getAllLogsFiles
|
* getAllLogsFiles
|
||||||
|
@ -222,11 +223,12 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.onKeyDown = function ($event) {
|
$document.bind('keydown', function ($event) {
|
||||||
if ($event.keyCode == 27) {
|
if ($event.keyCode == 27) {
|
||||||
$rootScope.sidebar = false
|
$rootScope.sidebar = false;
|
||||||
|
$rootScope.$digest()
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue