uppercaseOnly-directive.js
783 Bytes
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');
element.addClass('foca-input');
element[0].autocomplete = 'off';
}
};
}
]);