This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ng-pattern only work in angular 1.2.1, but not on 1.3.17, 1.4.3 and 1.4.4 #12618
Labels
Comments
It has to do with the way angular is handling the input -- After your 1.2.1 example the input fed into the pattern validator is a number type instead of a string. Thus, when it's There was a pretty heavy refactor in 1.3 that appears to have added the $parser to the inputDirective which is what is causing your woes. |
kacecode
added a commit
to kacecode/angular.js
that referenced
this issue
Aug 20, 2015
kacecode
added a commit
to kacecode/angular.js
that referenced
this issue
Aug 20, 2015
Set patternDirective validator to test against viewValue instead of modelValue. Closes angular#12344, angular#12618
Thanks for opening the issue. It's being tracked here already: #12344 |
Thank you for the answer, but..., the solution is????, or there is no solution ?, so it stays?. Greetings. :) |
@pokaxperia the fix is the above patch, which you will have to wait on the release of. In the interim, you can get regex matching from a text field |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello, I have a problem, I trying to validate an input number, setting 00.00. what I need?, only two digits after and before decimal dot, no matter if the two digits after decimal dot are 00.
Between many patterns, I found this that it serves me:
/^\d{0,1}(\d.\d)?\d?$/
I created four examples on plunker with different versions of angularjs, that explain my problem and no matter if set pattern instead ng-pattern attribute, still not working.
Angularjs 1.4.4 http://plnkr.co/edit/K00ffy?p=preview
Angularjs 1.4.3 http://plnkr.co/edit/jCYj97?p=preview
Angularjs 1.3.17 http://plnkr.co/edit/93absW?p=preview
Angularjs 1.2.1 http://plnkr.co/edit/ooFneS?p=preview
The last one works, but my question or the question is, what it's wrong?, me or the versions of AngularJS?.
Thank you.
The text was updated successfully, but these errors were encountered: