Skip to content

md-input ignores min and max values #413

@jdell64

Description

@jdell64

The code in question is:

  <md-input type="number" class="form-control"  min="1" align="end"  [(ngModel)]="numberOf" required></md-input>

vs:

  <input type="number" class="form-control"  min="1" align="end"  [(ngModel)]="numberOf" required>
  • Do you want to request a feature or report a bug?
    I would guess this is a bug since the html5 code works?
  • What is the current behavior?

My input is supposed to only take positive numbers (checked this in FF and Chrome):

(material is on the left, html5 is on the right):

Uploading html vs material_ff.png…

Using arrows, I cannot make the html5 number input lower than the min value (in this case 1). It also displays as red when manually lower than the min value.

  • Demo of issue

http://plnkr.co/edit/XKVHqFNNGDUDZ0S6fTHs?p=preview

  • What is the expected behavior?

To prevent negative values

  • What is the motivation / use case for changing the behavior?

Because it works in HTML 5 by default.

  • Which version of Angular and Material, and which browser and OS does this issue affect?

I am currently using the latest of Angular 2 and Material. I've tested it in Chrome and Firefox.

  • Other information

I have no idea how to fix... sorry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions