Reputation: 57
The problem is if I not give any digit after '.' then it shows error
I need output like the following
23 -> OK
5 -> OK
3.5 -> OK
Upvotes: 1
Views: 306
Reputation: 1227
You have to change your regex pattern. Try to replace the last part (\.\d{1,2})?
with (\.)?(\d{1,2})?
. This means that the .
can be set without having to enter the other two digits. You can play around with your regex pattern on regex101.com.
Upvotes: 1
Reputation: 428
You can use below code into your Angular 4
<input class="k-textbox" format="{0:c2}" type="number" step="0.01" onkeydown="return event.keyCode !== 69">
Upvotes: 0