angular.module('focaDirectivas') .directive('input', [ function() { return { require: '?ngModel', link: function(scope, element, attrs, modelCtrl) { if(attrs.type === 'text' && !attrs.readonly && !attrs.disabled && !attrs.uibDatepickerPopup) { modelCtrl.$parsers.push(function(input) { return input ? input.toUpperCase() : ''; }); } element.addClass('text-uppercase'); } }; } ]);