This repository has been 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
maxlength directive doesn't work with numbers #8811
Comments
This is a duplicate of #7848 |
I'll try to get someone interested in this for the next beta / RC. |
a fix for this has already been written, it's never been reviewed or merged #7968 |
The PR in question is #7968 |
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Aug 28, 2014
Use viewValue for minlength/maxlength validation if model value is not a string. This allows ngMinlength and ngMaxlength to be used for number inputs. Closes angular#7967 Closes angular#8811
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The
maxlength
directive is broken when used withNumber
model values in the current Beta. When I try usingtimepicker
from angular-bootstrap, the hours/minutes inputs become invalid as soon as they reach values>= 10
. This happens because, for the sake of readability, values< 10
are prefixed with a zero and saved to the model as strings. Values>= 10
are saved as numbers, which makes this offending line in the directive:fail, as
value.length
equals toundefined
forNumber
s. Changing the code toseems to work just fine.
Thanks in advance for the fix.
The text was updated successfully, but these errors were encountered: