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

ng-change gets triggered when a prohibited value is entered #146

Open
min-che opened this issue Dec 21, 2015 · 2 comments
Open

ng-change gets triggered when a prohibited value is entered #146

min-che opened this issue Dec 21, 2015 · 2 comments
Labels

Comments

@min-che
Copy link

min-che commented Dec 21, 2015

I'm using ui-money-mask, and I have a function that gets called on ng-change.
When I try to enter a character, the value will (visually) not be changed, but ng-change gets triggered.

I'm using version 2.1.1


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@assisrafael assisrafael added the bug label Jan 4, 2016
@assisrafael
Copy link
Owner

Can you write a test case that reproduce this behaviour?

detinho added a commit to detinho/angular-input-masks that referenced this issue Jun 12, 2016
* fix ng-change beeing called multiple times (issue assisrafael#146)
@detinho
Copy link
Contributor

detinho commented Jun 12, 2016

I've made some tests and concluded that:

  1. This behavior only happens if you clear the input and start typing invalid content, a letter for example. This way, ng-change will be fired as long as you type invalid content.
  2. With the ui-number-mask the behavior is slight different: if you clear the input and type invalid content it fires ng-change, but already converts the model value to zero, so the ng-change will be fired only once.

I think the ui-number-mask behavior is correct, as the input value really changed from empty (undefined) to zero, so I've created a new pull request changing uiMoneyMask (#194).

detinho added a commit to detinho/angular-input-masks that referenced this issue Jun 12, 2016
* fix ng-change beeing called multiple times (issue assisrafael#146)
assisrafael pushed a commit that referenced this issue Jun 20, 2016
* fix ng-change beeing called multiple times (issue #146)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants