I have a number of input boxes on a html page. I want to restrict the user from entering any numbers after 2 decimals.
Currently try to apply html 5 input Step="0.00" but doesn't work.
Any typescript solution is also ok
I have a number of input boxes on a html page. I want to restrict the user from entering any numbers after 2 decimals.
Currently try to apply html 5 input Step="0.00" but doesn't work.
Any typescript solution is also ok
don't use
Step
usestep
and if still you want old browser's support you can opt for javascript code for sameI got the solution using @pipe
And Pipe Extends in my directive.
Import Directive on your component
And Directive on your html Input
See demo of below directive in Plnkr.
You can achieve this using the following directive :
The HTML usage is as follows:
If you find any bugs with it please let me know in the comments below.
P.S: This directive is improved work upon this answer to validate decimal points.