summaryrefslogtreecommitdiffstats
path: root/js/directive
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-11 21:11:42 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-11 21:11:42 +0200
commit3e313821cf21e6443ab1b75336c8c510d758fa43 (patch)
tree0c2533226308322030548d11de107179288ebe77 /js/directive
parentf3091d84e14537a42334e66ea6588cf2b83f9ab6 (diff)
fix autofocus
Diffstat (limited to 'js/directive')
-rw-r--r--js/directive/NewsAutoFocus.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/js/directive/NewsAutoFocus.js b/js/directive/NewsAutoFocus.js
index 87bcab006..02edb0efa 100644
--- a/js/directive/NewsAutoFocus.js
+++ b/js/directive/NewsAutoFocus.js
@@ -10,10 +10,12 @@
app.directive('newsAutoFocus', function () {
'use strict';
return function (scope, elem, attrs) {
- if (attrs.newsAutofocus) {
- $(attrs.newsAutofocus).focus();
- } else {
- elem.focus();
+ var toFocus = elem;
+
+ if (attrs.newsAutoFocus) {
+ toFocus = $(attrs.newsAutoFocus);
}
+
+ toFocus.focus();
};
}); \ No newline at end of file