diff options
| author | Matias Niemelä | 2013-06-13 22:30:11 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-06-17 21:23:22 -0700 |
| commit | cec4ce28b93793caba75c7bab009d30bc97b6146 (patch) | |
| tree | 08169435a1da8da5a7eb3b7c6f1b7680d8fc29fe /docs/src/templates/js | |
| parent | 0cac8729fb3824ebb07cee84ef78b43900c7e75d (diff) | |
| download | angular.js-cec4ce28b93793caba75c7bab009d30bc97b6146.tar.bz2 | |
chore(ngdocs): allow user to press escape key to close docs search
Diffstat (limited to 'docs/src/templates/js')
| -rw-r--r-- | docs/src/templates/js/docs.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js index 2350e698..63ad31f4 100644 --- a/docs/src/templates/js/docs.js +++ b/docs/src/templates/js/docs.js @@ -138,6 +138,21 @@ docsApp.directive.focused = function($timeout) { }; }; +docsApp.directive.docsSearchInput = function() { + return function(scope, element, attrs) { + var ESCAPE_KEY_KEYCODE = 27; + element.bind('keydown', function(event) { + if(event.keyCode == ESCAPE_KEY_KEYCODE) { + event.stopPropagation(); + event.preventDefault(); + scope.$apply(function() { + scope.hideResults(); + }); + } + }); + }; +}; + docsApp.directive.code = function() { return { restrict:'E', terminal: true }; |
