Commit 9742d85ce9799d4915a833b691b7bbf12f95821b
Exists in
master
Merge branch 'master' into 'develop'
Master See merge request !12
Showing
1 changed file
Show diff stats
src/js/uppercaseOnly-directive.js
| 1 | angular.module('focaDirectivas') | 1 | angular.module('focaDirectivas') |
| 2 | .directive('input', [ | 2 | .directive('input', [ |
| 3 | function() { | 3 | function() { |
| 4 | return { | 4 | return { |
| 5 | require: '?ngModel', | 5 | require: '?ngModel', |
| 6 | link: function(scope, element, attrs, modelCtrl) { | 6 | link: function(scope, element, attrs, modelCtrl) { |
| 7 | if (attrs.type === 'text' && | 7 | if (attrs.type === 'text' && |
| 8 | !attrs.readonly && | 8 | !attrs.readonly && |
| 9 | !attrs.disabled && | 9 | !attrs.disabled && |
| 10 | !attrs.uibDatepickerPopup) { | 10 | !attrs.uibDatepickerPopup) { |
| 11 | |||
| 12 | modelCtrl.$parsers.push(function(input) { | 11 | modelCtrl.$parsers.push(function(input) { |
| 13 | return input ? input.toUpperCase() : ''; | 12 | return input ? input.toUpperCase() : ''; |
| 14 | }); | 13 | }); |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 17 | element.addClass('text-uppercase'); | 16 | element.addClass('text-uppercase'); |
| 17 | element.addClass('foca-input'); | ||
| 18 | element[0].autocomplete = 'off'; | 18 | element[0].autocomplete = 'off'; |
| 19 | } | 19 | } |
| 20 | }; | 20 | }; |
| 21 | } | 21 | } |
| 22 | ]); | 22 | ]); |