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

ngMinlength/ngMaxlength broken on input type=number #7967

Closed
sijmenvos opened this issue Jun 24, 2014 · 3 comments
Closed

ngMinlength/ngMaxlength broken on input type=number #7967

sijmenvos opened this issue Jun 24, 2014 · 3 comments

Comments

@sijmenvos
Copy link

The angular minlength of a number input isn't working as of Angular 1.3.0 beta 12.

I've created the bug in plunker:
http://plnkr.co/edit/vF3DMsbqIbm7EZbSvfQT?p=preview

@caitp
Copy link
Contributor

caitp commented Jun 24, 2014

can confirm, @matsko this broke with the changes to the attributes / aliasing, I believe. I'm not sure we ever figured out how we wanted maxlength to work for non-text input types, but maybe it's good enough to just convert the value to a string if it's a number?

(but yeah, why not use min/max instead of minlength/maxlength for numbers?)

@caitp
Copy link
Contributor

caitp commented Jun 24, 2014

view value, or stringified model value? I dunno.

@sijmenvos
Copy link
Author

In my case I need it to be id's that can could also be 0008373 or something, but I see this is not possible because the model value removes the zeroes in front. I'll use a text input with a regex instead in my case.

The min/max will indeed satisfy for a minimum length of a number (value).

Thanks for the quick answer.

@Narretz Narretz added this to the 1.3.0 milestone Jul 15, 2014
@btford btford removed the gh: issue label Aug 20, 2014
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
@caitp caitp closed this as completed in 77ce5b8 Aug 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants