Text Input allow only Integer input in angularjs

前端 未结 7 1067
梦如初夏
梦如初夏 2021-01-04 19:45

I want to set the html input[number] to allow only integer input (not float).

Basically, the html input

7条回答
  •  [愿得一人]
    2021-01-04 20:31

    I have looked for this many times, I had used directives in previous projects, but have finally founded a way that angular js provides by itself and hence can get rid of directives. Take a look at this code given at this link angularJs

    The code shown there is as follows :

    
    
    Required! Not valid number!
    value = {{example.value}}
    myForm.input.$valid = {{myForm.input.$valid}}
    myForm.input.$error = {{myForm.input.$error}}
    myForm.$valid = {{myForm.$valid}}
    myForm.$error.required = {{!!myForm.$error.required}}

提交回复
热议问题