0

I'm working in IE 11 browser and I want to restrict the input number field to 3 digits with 5 decimal places. I tried the following

<input type="number" [(ngModel)]="amount" maxlength="3" />

The problem I face is it will allow me to add only 3 digits with no decimals. I tried to add pattern but in IE its not supporting (Angular-2.4). How to handle this?

Protagonist
  • 1,649
  • 7
  • 34
  • 56
  • [`pattern` is indeed supported in IE11](https://caniuse.com/#search=pattern). It's standard HTML5. BTW, this question has nothing to do with Angular. –  May 29 '17 at 18:23
  • @torazaburo input type number does not work in IE 11. It allows to enter characters as well. Need do write keypress event. What say? – Protagonist May 29 '17 at 18:28
  • `pattern="\d{1,3}\.\d{5}"` doesn't work? `type=number` works all the way back to IE10. –  May 29 '17 at 18:33
  • Its not working + allowing me to enter characters too – Protagonist May 29 '17 at 18:51
  • you can achieve this using directives. refer this answer with max votes https://stackoverflow.com/questions/41465542/angular2-input-field-to-accept-only-numbers and change as your requirements – sainu May 30 '17 at 08:06

0 Answers0