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

Value of ng-model becomes undefined on submit #12

Open
a-stankevich opened this issue Jun 15, 2018 · 0 comments · May be fixed by #15
Open

Value of ng-model becomes undefined on submit #12

a-stankevich opened this issue Jun 15, 2018 · 0 comments · May be fixed by #15

Comments

@a-stankevich
Copy link

When input is inside a form and form is submitted, the value in the model becomes undefined.

On form submit code execution gets into parser at https://github.com/jstroem/ng-input-currency/blob/master/src/ng-input-currency.js#L75, and value is formatted currency string like '$10,000.00'. Next preformatValue doesn't expect this kind of string, neither does currency filter, so the function result is undefined.

Simply replacing preformatValue with toFloat seems to fixing the issue for me. But I don't get the idea behind preformatValue and it's not used anywhere else, so maybe there's a better fix for that.

I've put together a simple plunkr to reproduce this
https://next.plnkr.co/edit/8iRKPjGbhxiCrsPb

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

Successfully merging a pull request may close this issue.

1 participant