From b8031a7876b2118f29e5c3e94a91b9d369ca5e5a Mon Sep 17 00:00:00 2001 From: guikubivan Date: Thu, 21 Apr 2016 11:34:19 -0600 Subject: [PATCH] Make sure we pass in an argument to focusOn directive --- lib/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index de59aff..032a993 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,11 +5,13 @@ app = angular.module('focusOn', []); app.directive('focusOn', function() { return function(scope, elem, attr) { - return scope.$on('focusOn', function(e, name) { - if (name === attr.focusOn) { - return elem[0].focus(); - } - }); + if(attr.focusOn){ + return scope.$on('focusOn', function(e, name) { + if (name === attr.focusOn) { + return elem[0].focus(); + } + }); + } }; });