Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Formatting needs better case handling: cut, paste, select, undo, redo, contextmenu #64

Open
mpiasta-ca opened this issue Jan 9, 2015 · 2 comments

Comments

@mpiasta-ca
Copy link

It's really basic at the moment, lots of cases are not being handled. Might be worth to port-in a complete jQuery solution instead. I'm working on a business project and took a more complex approach to formatting the card number. What I do is upon any change, I flash the reformatted card number, and then I position the caret back to its expected position. It's a lot of work, but the finished result is much smoother.

You may also want to refrain from using event.preventDefault(), as this stops the scope on the field from $digesting. So if another directive is watching a change to the value, it won't be propagated as expected..

@benjamincharity
Copy link

Big +1 to rethinking the $digest blocking. A bound model should always contain the content. IMO a plugin should never overwrite a piece of core framework functionality unless that plugin is specifically designed to do just that. We shouldn't need a work-around just to know if an input has content.

@bendrucker
Copy link

Give angular-credit-cards 2.3 a shot. I've added formatting that does a reasonably good job of getting the cursor position right without breaking out of Angular's native input handling events.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants