Last active
September 13, 2017 01:47
-
-
Save Matheus-de-Souza/7245feea2c383bf3379a5d69dde4aec8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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