Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputMask with ngModel not updating first character #587

Closed
andrevcf opened this issue Jul 11, 2016 · 2 comments
Closed

InputMask with ngModel not updating first character #587

andrevcf opened this issue Jul 11, 2016 · 2 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@andrevcf
Copy link

andrevcf commented Jul 11, 2016

<p-inputMask mask="(99) 9999[9]-9999" [unmask]="true" name="cel" [(ngModel)]="cel" required></p-inputMask>

With the example above, when i type 2 digits the model is updated with 1 digit only.
For example: I type "4", the model is blank. When I type "34" the model is now 3. When I type "342" then the model is 34.
The backspace is working fine and updating correctly

@andrevcf andrevcf changed the title InputMask ngModel not updating first character InputMask with ngModel not updating first character Jul 11, 2016
@KonbOgonb
Copy link

KonbOgonb commented Jul 20, 2016

Current implementation of inputmask uses onKeyDown event as time moment when to flash masked or unmasked value. This approach is wrong because when onKeyDown is fired value does not contain newly added character. So if we perform validation on the fly with each change of text, we are going to receive text without last character. Due to it we have this bug, when first character is not validated when it is entered. Possible solution could be to used key up event of to flash text to value.

@ryanwawr
Copy link

Having the same problem. Would definitely like to see this fixed soon, since it's a fairly significant issue when trying to use p-inputMask with a search element.

cagataycivici added a commit that referenced this issue Jul 23, 2016
Fix for issue #587 - Input mask with ngModel lags by one character
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jul 23, 2016
@cagataycivici cagataycivici added this to the 1.0.0-beta.11 milestone Jul 23, 2016
@cagataycivici cagataycivici self-assigned this Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

4 participants