<input class="span10" type="number" max="99999" ng-maxLength="5" placeholder="Enter Points" ng-change="myFunc($index)" ng-model="myVar">
如果值大于99999或5位,则只会将form.input.$valid
的值更改为false
。否则为true
。但是,用户仍然可以输入任何长度的号码。 我只想限制他输入的数字,就像html的maxlength一样。
答案 0 :(得分:2)