diff --git a/src/main/webapp/js/directives.js b/src/main/webapp/js/directives.js index 49aa2842..56c2b736 100644 --- a/src/main/webapp/js/directives.js +++ b/src/main/webapp/js/directives.js @@ -1,5 +1,21 @@ var module = angular.module('commafeed.directives', []); +module.directive('focus', [ '$timeout', function($timeout) { + return { + restrict : 'A', + link : function(scope, element, attrs) { + scope.$watch(attrs.focus, function(value) { + if (!value) + return; + $timeout(function() { + $(element).focus(); + }); + }); + } + }; +} ]); + + /** * Open a popup window pointing to the url in the href attribute */ diff --git a/src/main/webapp/templates/_subscribe.html b/src/main/webapp/templates/_subscribe.html index 228f5cf9..910ee6d1 100644 --- a/src/main/webapp/templates/_subscribe.html +++ b/src/main/webapp/templates/_subscribe.html @@ -20,7 +20,7 @@