summaryrefslogtreecommitdiffstats
path: root/js/directive
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-10-03 17:42:12 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2015-10-03 17:42:49 +0200
commit2afaba240006f95350f8f3425a17ac1fd5ffdace (patch)
tree0edcee667eb779454f68d2e60ec663612de15784 /js/directive
parentf1d0e020e44214768b7df14bef694952299513d3 (diff)
fix #863
Diffstat (limited to 'js/directive')
-rw-r--r--js/directive/NewsSearch.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/js/directive/NewsSearch.js b/js/directive/NewsSearch.js
index ca8de9744..f27aceaeb 100644
--- a/js/directive/NewsSearch.js
+++ b/js/directive/NewsSearch.js
@@ -19,11 +19,17 @@ app.directive('newsSearch', function ($document, $location) {
var box = $('#searchbox');
box.val($location.search().search);
- box.on('search', function () {
- var value = $(this).val();
+ var doSearch = function () {
+ var value = box.val();
scope.$apply(function () {
scope.onSearch(value);
});
+ };
+
+ box.on('search keyup', function (event) {
+ if (event.type === 'search' || event.keyCode === 13) {
+ doSearch();
+ }
});
// carry over search on route change
@@ -38,4 +44,4 @@ app.directive('newsSearch', function ($document, $location) {
});
}
};
-}); \ No newline at end of file
+});