In my Angular 2 application, I have a component with an input field that should accept a range of numbers.
More specifically, 2 cases:
- range 0 [0] -23 (hours)
- range O [0] -59 (minutes)
I use
<form> <input type="text" pattern="[0-9]"> <input type="text" pattern="\d|1\d|2[0-3]"> <input type="text" pattern="\d\d"> </form>
The problem is that I can basically type in anything ( as if the check were ignored ), including the text. I don't think this is an Angular 2 related issue as standard validation works like
<input type="number">
allows you to enter only numbers (but any number that is not what I want)
I also tried with min = 0 and max = 23 (or 59) attributes with type number , but this does not work either.
source share