<input type="number" min="0" max="100" maxlength="5" class="number" ng-model="formData.age" validator="number,required,range" ng-class="{'has-error':orderForm.age.$invalid}" ng-blur="showError(true)"
ng-mouseenter="isShowTipsA=true" ng-mouseleave="isShowTipsA=false" is-show-tips="isShowTipsA"
range-error-message="年龄应该在0~100之间" required-error-message="这是必填项">
/**
* Range Validation
*/
$validationProvider.setExpression({
range: function(value, scope, element, attrs) {
if (value >= parseInt(attrs.min) && value <= parseInt(attrs.max)) {
return value;
}
}
}).setDefaultMsg({
range: {
error: 'Number should between 0 ~ 100',
success: 'good'
}
});