我有一个自定义验证指令,我将其归因于表单
<form myValidations>
app.directive('myValidations', function(){
return{
//require: 'ngModel', note its commented out
link: function(s,e,a,ctrl){//note the emphasis on the ctrl
}
}
});
现在,如果我没有'require:ngModel'来为我做这件事,我将如何掌握这个 ctrl.$parsers。
我可以找到一个元素,然后在某个函数中调用它的 ng-model 以返回一个 ng-model-controller 吗?这样我就可以从那里#$parsers?