Closed a0y1a closed 4 years ago
@a0y1a, I have test it and it works (your pattern is correct)
I think that the problem comes from record.score
. If it has 1.1234567
, the input will reflect its value, although it's 'invalid'.
Have you fill the input by hand or it's the binded value?
The binded value is zero, then I change and fill the input by hand. According to my understanding, after I typed 1.123, if I go on typing 4, it should be prevented. Do I miss something or should I do something else to implement it ?
@tonivj5
Hi @a0y1a, I am not able to reproduce this problem. Please try this example in StackBlitz. I have tried Chrome, Edge, Firefox. All of them works, i.e., the input only allows 1.123.
I am afraid that you are using a different browser, but shouldn't matter, because keyboard event is almost generic across browsers. Another possible reason could be something like an iframe that prevents this directive act on your Angular module.
Anyway, you can start from the StackBlitz example, and work towards your component to see if you can reproduce the error.
@changhuixu Thanks for your feedback. I use Chrome. I tried example in StackBlitz, it works well. Then I copy the example in my project and run it in a new tab, it works not well. No error tips on chrome console. I will try to explore what causes this problem.
close this issue due to lack of reproducibility.
Digit Only input only allows three decimal places not working for me. I don't know what caused it.
See pictures below: