cc-format does not support android
Closed this issue · 1 comments
GuyMograbi commented
Steps to reproduce:
- Go to your demo plunker
- add
cc-format
on the input field - type
424242
==> Expected Result: the input field should display 4242 42
Actual Result: the input field displays 4242 24
- the last 2 numbers are inverse.
After some debugging of the code, it seems that in android, the function setCursorPostion
does not behave as expected.
A quick fix would be to wrap it with $timeout. something like
function setCursorPostion (element, position) {
$timeout( () => {
if (element.setSelectionRange) {
element.setSelectionRange(position, position)
} else if (element.createTextRange) {
var range = element.createTextRange()
range.move('character', position)
range.select()
}
},0);
}
If this is acceptable, I will open a PR with this change (and I will also fix the typo 😄 )
bendrucker commented
I'd be happy to review a PR with a minimal code change