Commit 488b2c556dac8d3e29e43d15afcd6c36e9b1e408
1 parent
596d6dd51b
Exists in
master
directiva cambia type del input de acuerdo a si esta o no activo el teclado
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
src/js/focaTipo-directive.js
... | ... | @@ -0,0 +1,22 @@ |
1 | +angular.module('focaDirectivas') | |
2 | + .directive('focaTipoInput',['$rootScope', function($rootScope) { | |
3 | + var mostrarTeclado; | |
4 | + return { | |
5 | + link: function(scope, element, attr, ctrls) { | |
6 | + if(mostrarTeclado) { | |
7 | + element[0].type = 'text'; | |
8 | + return; | |
9 | + } | |
10 | + element[0].type = 'number'; | |
11 | + $rootScope.$on('usarTeclado', function(event, data) { | |
12 | + if(data){ | |
13 | + mostrarTeclado = true; | |
14 | + element[0].type = 'text'; | |
15 | + return; | |
16 | + } | |
17 | + mostrarTeclado = false; | |
18 | + element[0].type = 'number'; | |
19 | + }); | |
20 | + } | |
21 | + } | |
22 | + }]); |