我有一个这样的表格
<input type="text" id="theName">
<input type="number" id="theNumber">
<input type="button" id="submitForm">
那么如何在单击按钮时通过 AngularJs 进行验证。输入不能为空,并且 #theNumber 输入中的数字必须等于或大于 0。
最佳答案
这样的事情应该有效:
<form ng-controller="FormController as FormCtrl">
<input type="text" required id="theName" ng-model="FormCtrl.name">
<input type="number" required min="1" max="10" id="theNumber" ng-model="FormCtrl.number">
<button type="submit" id="submitForm">Submit</button>
</form>
关于html - 如何使 <input type ="number"> 大于或等于数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34374066/