Commit 18993a9d31e6734fbe726ea5e515e4fb7f7ff7f8

Authored by Pablo Marco del Pont
Exists in master

Merge branch 'master' into 'master'

Master (pmarco)

See merge request modulos-npm/foca-directivas!7
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
1 1 angular.module('focaDirectivas')
2 2 .directive('tecladoVirtual', function() {
3   - return function( scope, elem, attrs ) {
4   - elem.bind('blur', function() {
5   - scope.$emit('focus', false);
  3 + return function(scope, elem, attrs) {
  4 + elem.bind('blur', function() {
  5 + scope.$emit('blur');
6 6 });
7 7 elem.bind('focus', function() {
8   - scope.$emit('focus', true);
  8 + scope.$emit('focus');
9 9 });
10 10 };
11 11 });