标准angularjs验证正常工作:
<form name="myForm"><input name="name" ng-model="name" ng-minlength="10"/></form>
但是我不能从我的指令开启它:
<form name="myForm"><input name="name" ng-model="c.name" dynval /></form>
.directive('dynval', function () {
return {
require: 'ngModel',
link: function ($scope, element, attr, ctrl) {
attr.$set('ng-minlength', 100);
}
};
});
答案 0 :(得分:1)