html
====
<input validator1 type='text' class='form-control' ng-model='uniform'><span style='color:red' ng-show="form1.$error.validator1">*</span>
javascript
====
directive("validator1", function () {
return {
restrict: 'A',
require: "ngModel",
link: function (scope, element, attributes, ngModel) {
ngModel.$validators.validator1 = function (modelValue, viewValue) {
... // return true or false
}
}
};
})
沒有留言:
張貼留言