AngularJS表单验证指令,用于显示输入错误的数字

时间:2015-04-08 06:24:18

标签: angularjs jsp

您好我正在尝试在文本框中验证号码,以便用户无法输入文本(字母),但不显示消息。

 <form name="preSourceThresholdForm">
         <div class="col-md-12 h6 b" style="padding-bottom: 40px;">
            <b>Configure PreSource Threshold</b>
            <input type="hidden" class="form-control" id="preSourceThresholdGroup" ng-model="admin.preSourceThresholdGroup" value="PreSource Threshold">
         </div>
         <div class="col-md-3 b" style="padding-top: 0px">
            PreSource Threshold
         </div>
         <div class="col-md-2">
            <input type="number" min="0" max="100" name="preSource"  ng-model="admin.preSourceThreshold" required> %
              <span ng-show="preSourceThresholdForm.preSource.$error.number">Must Be Number!</span>
         </div>
         <div class="col-md-2">
            <input id="preSourceSave" type="button" ng-disabled="!admin.preSourceThreshold" ng-click="preSourceSave()" class="btn btn-default" value="Save" />
         </div>
      </form>

0 个答案:

没有答案