在这个项目中,, required
, max-size-number
, min-size-number
零件工作,但是 pattern
, minlength
,及 maxlength
零件不工作,
我怎样才能纠正这个问题?
这里是相关的代码部分;
<div ng-switch-when="TextBox">
<label class="item item-input item-stacked-label">
<span ng-if="haveHeader" class="input-label">{{header}}</span>
<input type="text" style="width:100%"
event="component.events"
validation="component"
ng-blur="isInAdminFormPage && checkTextTypeNumberValidation(component.shortName)"
name="name{{component.shortName}}"
metadata="component.options" ng-disabled="isFormViewed" string-to-date="component.options" ng-required="requiredValidation[component.shortName]"
ng-model="formData[component.shortName]" string-to-number="component.options" >
</label>
<br>
<div ng-if="componentValidationType[component.shortName] == validationType.VALIDATION">
<div style="color: red" ng-messages="getFormValidations(form.shortName)['name'+component.shortName].$error" ng-show="isInAdminFormPage && formInf.mainForm.$submitted">
<div ng-message="required">{{message["required"]}}</div>
<div ng-message="minlength">{{message["minlength"]}}</div>
<div ng-message="maxlength">{{message["maxlength"]}}</div>
<div ng-message="ng-pattern">{{message["ng-pattern"]}}</div>
</div>
<div ng-if="isInAdminFormPage" style="color: red" ng-show="showValidationMessageOfTextBox(component.shortName) && formInf.mainForm.$submitted">
<div ng-show="!maxNumberValidation[component.shortName].validation">{{message["max-number-size"]}}</div>
<div ng-show="!minNumberValidation[component.shortName].validation">{{message["min-number-size"]}}</div>
</div>
</div>
这些验证在何处使用的图片:
1条答案
按热度按时间yfwxisqw1#
很难复制您的示例,但我认为这将为您提供集成所需的所有信息
ng-pattern
,ng-minlength
及ng-maxlength
,以及如何侦听其验证器。