javascript - Accepting only integers and floating point numbers in angular js on each key stroke -


how can angular js monitor key strokes in such way input field in html not accept non numerical values? , accept integers , floating point numbers on each key stroke?

<form name="myform">   <input ng-pattern="/^(?=.+)(?:[1-9]\d*|0)?(?:\.\d+)?$/" ng-model="value" name="number"/>   valid? {{myform.number.$valid}} </form> 

if asking correct "float/integers" regex pattern try 1 :

/^\-?\d+((\.|\,)\d+)?$/ 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -