From beee5a3003314372604b36a26cd0b1e101ca5699 Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Tue, 21 Oct 2014 16:42:40 -0700 Subject: [PATCH 1/2] Add focus directive to be used to give input elements focus --- public/src/js/directives.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/src/js/directives.js b/public/src/js/directives.js index 2d2e7f6..4426c42 100644 --- a/public/src/js/directives.js +++ b/public/src/js/directives.js @@ -72,4 +72,20 @@ angular.module('insight') }); } }; + }) + .directive('focus', function ($timeout) { + return { + scope: { + trigger: '@focus' + }, + link: function (scope, element) { + scope.$watch('trigger', function (value) { + if (value === "true") { + $timeout(function () { + element[0].focus(); + }); + } + }); + } + }; }); From 9e33a4abd86472497bcabd9e4869a7511da19a3b Mon Sep 17 00:00:00 2001 From: Andrew Hart Date: Tue, 21 Oct 2014 16:44:12 -0700 Subject: [PATCH 2/2] Add focus directive to search box text input --- public/views/includes/header.html | 2 +- public/views/includes/search.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/views/includes/header.html b/public/views/includes/header.html index 4affacd..94d4d8e 100644 --- a/public/views/includes/header.html +++ b/public/views/includes/header.html @@ -17,7 +17,7 @@ diff --git a/public/views/includes/search.html b/public/views/includes/search.html index cbda5d7..af7d8b9 100644 --- a/public/views/includes/search.html +++ b/public/views/includes/search.html @@ -1,6 +1,6 @@