The below ‘validNumber’ directive verifies that the input field has a valid number by checking the last key pressed. If it is a valid number it continues the operation, but if not the directive prevents the input action and the character is not inserted in the input box.
This directive also handles decimal points. To enable this option, you have to add ‘enable-decimals’ as an attribute in the <input type=”text”> html code and assign ‘true’ or ‘false’ as required. Continue reading