【发布时间】:2020-06-10 03:59:00
【问题描述】:
我正在使用 angular-auto-validate 来验证我的表单。我在下面的文本框中验证了最小值。请检查
<input type="text"
ng-min="1"
ng-pattern-err-type="minVal" angular-currency="options"
ng-required="newtransport.isFixedAmount == true" ng-currency
fraction="2" currency-symbol=""
ng-model="newtransport.totalMarketValue"
placeholder="Total Amount" class="form-control"
ng-readonly="newtransport.isFixedAmount == false"
ng-keyup="setTransportTaxExemptAmt();isFixedTaxLiableAmount();" />
验证消息正确出现。但我需要为其添加自定义消息。 我在我的文本框中添加了 ng-pattern-err-type="minVal" 属性。但它不起作用。
我的留言如下
.run(function (defaultErrorMessageResolver, validator) {
validator.setValidElementStyling(false);
defaultErrorMessageResolver.getErrorMessages().then(function (errorMessages) {
errorMessages['minVal'] = "Value should be greater than 0";
});
})
当前消息
我如何为此添加自定义消息。
【问题讨论】:
标签: javascript angularjs