How to only allow the numbers 0-5 in <input> fields with AngularJS?

前端 未结 2 1222
无人及你
无人及你 2021-01-21 23:52

I have an input field like this:

HTML



        
2条回答
  •  半阙折子戏
    2021-01-22 00:41

    You can use ngPattern to set the regular expression which you want to validate against.

    Reffer to the docs for more details: https://docs.angularjs.org/api/ng/directive/input

提交回复
热议问题