Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-change stops triggering after invalid input (when ng-pattern is used) #1296

Closed
magnusart opened this issue Aug 26, 2012 · 4 comments
Closed

Comments

@magnusart
Copy link

Hi

When I use both ng-change and ng-pattern, it seem like ng-change stops triggering whenever validation is false.

Example here with explanation:
http://jsfiddle.net/Magnusart/bLk53/2/

@magnusart
Copy link
Author

From the angularjs chat on freenode I got some more information.

ng-pattern stops the subsequent changes to the model whenever ng-pattern is false. So ng-change is a bad choice when triggering javascript to show/hide info popovers to hint the user that the input is not valid as it will stop triggering as soon as validation is false.

If this is not considered to be a bug at least the docs could be updated to state that ng-chage: "Evaluate given expression when model changes as the result of user interacting with the input" (pkozlowski_os). Perhaps with an example or reference to what cases ng-change would not be triggered.

@RyanQuackenbush
Copy link

I would consider this a bug. ng-change should do just that: trigger on a change regardless of input validation status.

@btford
Copy link
Contributor

btford commented Jan 14, 2014

If someone wants to open a PR to clarify this in the docs, that'd be great.

@btford btford closed this as completed Jan 14, 2014
@toedoro
Copy link

toedoro commented Apr 23, 2018

hi i also encounter this problem as of the moment, is there any resolution about this?

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

No branches or pull requests

4 participants