You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Hello,
I have stumbled upon an issue with ng-maxlength (same with ng-minlength) attribute of the text input (and textarea). After adding the validation and setting programmatically value of the input, the ng-change expression is being evaluated, while according to the docs, it should be executed only after user interaction.
I'm not 100% sure, but the issue occurs when the value being set for the input is valid.
Live example here: http://plnkr.co/edit/Fbbfm3vsYsAFmGVAL0Q8?p=preview
The text was updated successfully, but these errors were encountered:
I think this is actually correct, the documentation error is just that... a documentation error. It's the only sane way we can do it consistently for everything that uses ngModel --- I would consider this a non-bug
Ok, now it only happens when the validator returns false. Very inconsistent. I don't think this is right, as the model hasn't changed. Maybe ngChange never took inital scope values into account.
ngChange just registers a listener to ngModel's array of listeners which are notified when the model changes. It has no machinery for caring whether the value actually changed or not, that's ngModel's responsibility.
Ah, okay now I see it. ngChange fires because the model is set to undefined, because it's invalid. So it's working as intended. If you want invalid modelValues on $scope, you can use allowInvalid in ngModelOptions.
Hello,
I have stumbled upon an issue with
ng-maxlength
(same withng-minlength
) attribute of the text input (and textarea). After adding the validation and setting programmatically value of the input, theng-change
expression is being evaluated, while according to the docs, it should be executed only after user interaction.I'm not 100% sure, but the issue occurs when the value being set for the input is valid.
Live example here: http://plnkr.co/edit/Fbbfm3vsYsAFmGVAL0Q8?p=preview
The text was updated successfully, but these errors were encountered: