From 7e1b64a83b710514ddd299c5a8cbeeceb6d4dfae Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 31 Jul 2016 22:46:16 +0800 Subject: [PATCH] support auto focus "download links" text box when entering "new task" page --- src/index.html | 1 + src/scripts/directives/autoFocus.js | 14 ++++++++++++++ src/views/new.html | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/scripts/directives/autoFocus.js diff --git a/src/index.html b/src/index.html index c1b733e..7774ed9 100644 --- a/src/index.html +++ b/src/index.html @@ -305,6 +305,7 @@ + diff --git a/src/scripts/directives/autoFocus.js b/src/scripts/directives/autoFocus.js new file mode 100644 index 0000000..4dbb7ed --- /dev/null +++ b/src/scripts/directives/autoFocus.js @@ -0,0 +1,14 @@ +(function () { + 'use strict'; + + angular.module('ariaNg').directive('ngAutoFocus', ['$timeout', function ($timeout) { + return { + restrict: 'A', + link: function (scope, element) { + $timeout(function () { + element[0].focus(); + }); + } + }; + }]); +})(); diff --git a/src/views/new.html b/src/views/new.html index d1c4d24..4091afa 100644 --- a/src/views/new.html +++ b/src/views/new.html @@ -43,7 +43,7 @@

Download Links:

-