changhuixu / ngx-digit-only

An Angular directive to only allow [0-9] in the input box when typing, pasting or drag/dropping.

Home Page:https://changhuixu.github.io/ngx-digit-only/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

min and max prevent entering of many numbers if min is more than 1

bjoern-steinborn opened this issue · comments

If min is set to 6 and max to 100 one cannot enter 55, as the 5 key is prevented.

@changhuixu Is there any update?

@changhuixu
The [min] cannot be used now because there's a e.preventDefault when newNumber < this.min.
Imagine the min is set to 20 and the user starts typing in the input field. When the user wants to type "15", (s)he first enters a "1". This is smaller than this.min, so the keypress is prevented. This way, the user can't type any number into the field, which is the bug.