angular-ui / ui-mask

Mask on an input field so the user can only type pre-determined pattern
https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html
MIT License
391 stars 258 forks source link

Paste not working #235

Open Jammy42 opened 6 years ago

Jammy42 commented 6 years ago

Pasting a value does not work if there is a "constant" in the placeholder. If using https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html:

For example:

ui-mask = (123) 999-9999, where 123 is a constant prefix. If the value 123 333-3333 is pasted then the value in the mask is displayed as (123) 123-3333. Basically 123 prefix ist duplicated.

The bug lies in the function unmaskValue(value), where the prefix 123 is not considered during the unmasking.

Any chance that this could be fixed ?