Skip to content

Instantly share code, notes, and snippets.

@Matheus-de-Souza
Last active September 13, 2017 01:47
Show Gist options
  • Save Matheus-de-Souza/7245feea2c383bf3379a5d69dde4aec8 to your computer and use it in GitHub Desktop.
Save Matheus-de-Souza/7245feea2c383bf3379a5d69dde4aec8 to your computer and use it in GitHub Desktop.
(function (angular) {
angular
.module('project.directives')
.directive('input', input);
// Monkey patch para problema de máscara nos telefone samsung da série 6
function input($timeout) {
return {
restrict: 'E',
link: function ($scope, $element, $attrs) {
if ($attrs.$attr.uiBrCepMask || $attrs.$attr.uiBrPhoneNumber) {
$element.on('input keydown keyup click focus', function ($event) {
if ($event.keyCode != 8) {
$timeout(function () {
$event.target.selectionStart = $event.target.value.length;
$event.target.selectionEnd = $event.target.value.length;
}, 10);
}
});
}
}
};
}
})(window.angular);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment