Commit 596d6dd51b75a866c4454dd0820cfecf973c3f3f
Exists in
master
Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-directivas
Showing
3 changed files
Show diff stats
src/js/escKey-directive.js
... | ... | @@ -3,9 +3,9 @@ angular.module('focaDirectivas') |
3 | 3 | return function(scope, element, attrs) { |
4 | 4 | element.bind('keydown keypress', function(event) { |
5 | 5 | if(event.which === 27) { // 27 = esc key |
6 | - scope.$apply(function (){ | |
6 | + scope.$apply(function() { | |
7 | 7 | scope.$eval(attrs.escKey); |
8 | - }); | |
8 | + }); | |
9 | 9 | event.preventDefault(); |
10 | 10 | } |
11 | 11 | }); |
src/js/focus-directive.js
... | ... | @@ -6,14 +6,14 @@ angular.module('focaDirectivas') |
6 | 6 | } |
7 | 7 | } |
8 | 8 | |
9 | - return { | |
9 | + return { | |
10 | 10 | restrict: "A", |
11 | - link: function (scope, element, attrs, ctrls) { | |
11 | + link: function(scope, element, attrs, ctrls) { | |
12 | 12 | checkDirectivePrerequisites(attrs); |
13 | 13 | |
14 | - scope.$watch(attrs.focaFocus, function (currentValue, lastValue) { | |
14 | + scope.$watch(attrs.focaFocus, function(currentValue, lastValue) { | |
15 | 15 | if(currentValue == true) { |
16 | - $timeout(function () { | |
16 | + $timeout(function() { | |
17 | 17 | element.focus(); |
18 | 18 | }); |
19 | 19 | } |
src/js/tecladoVirtual-directive.js
... | ... | @@ -0,0 +1,11 @@ |
1 | +angular.module('focaDirectivas') | |
2 | + .directive('tecladoVirtual', function() { | |
3 | + return function(scope, elem, attrs) { | |
4 | + elem.bind('blur', function() { | |
5 | + scope.$emit('blur'); | |
6 | + }); | |
7 | + elem.bind('focus', function() { | |
8 | + scope.$emit('focus'); | |
9 | + }); | |
10 | + }; | |
11 | + }); |