summaryrefslogtreecommitdiffstats
path: root/js/directive/NewsAutoFocus.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/directive/NewsAutoFocus.js')
-rw-r--r--js/directive/NewsAutoFocus.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/js/directive/NewsAutoFocus.js b/js/directive/NewsAutoFocus.js
index 02edb0efa..0fa4a77c7 100644
--- a/js/directive/NewsAutoFocus.js
+++ b/js/directive/NewsAutoFocus.js
@@ -7,7 +7,7 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
-app.directive('newsAutoFocus', function () {
+app.directive('newsAutoFocus', function ($timeout) {
'use strict';
return function (scope, elem, attrs) {
var toFocus = elem;
@@ -16,6 +16,9 @@ app.directive('newsAutoFocus', function () {
toFocus = $(attrs.newsAutoFocus);
}
- toFocus.focus();
+ // to combat $digest already in process error when route changes
+ $timeout(function () {
+ toFocus.focus();
+ }, 0);
};
}); \ No newline at end of file