[Input] Maxlength not working
Bug, feature request, or proposal:
md-input type=number maxlength, minlength attributes are not working
What is the expected behavior?
suppose to check length of the field
What is the current behavior?
its ignoring the field length.
What are the steps to reproduce?
Providing a StackBlitz/Plunker (or similar) is the best way to get the team to see your issue.
Plunker starter (using on @master): https://goo.gl/uDmqyY
StackBlitz starter (using latest npm release): https://goo.gl/wwnhMV
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
Don't close this we don't want to use tel, we need to use number field not text field.
md-input maxlength is not working with type number.... #1934
maxLength on input not working for type="number" #4940
Closed
Maxlength in mdInput not working #6557
please fix md-input max length or allow pattern for type as text field.
This is not a bug in Angular Material. The reason those other bugs were closed is that they're expecting a behavior that is not supported by type="number" inputs. As stated here maxlength is only supported on the following input types: text, email, search, password, tel, or url
Ok Thanks for response, I am using the filed type "tel" but its accepting alphabets, my requirement is numeric field type with max length. please advise.
you could add a keydown listener and block events for non-numerical characters like this: https://stackblitz.com/edit/angular-material2-issue-74wjpe?file=app/app.component.ts
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.