In my custom command, I need to update the validity of another input. The instruction is something like this:
& lt; CustomDirective = "foo" & gt;
, in which the value foo is the name of the other ngmodel.
My director, I can get the model of this like this:
var foo = scope [attrs.foo];
But how can I get its NGMDL controller to determine its validity? Just like this: fooModelController $ SetValidity ('custom directive' is true);
Edit:
In HTML, the input is defined:
& lt; Input type = "text" name = "dateDebut" id = "dateDebut" class = "form-control" ng-model = "formData.dateDebut" customDirective = "dateFin" required & gt; & Lt; Input type = "text" name = "dateFin" id = "dateFin" class = "form-control" ng-model = "formData.dateFin" customDirective = "dateDebut" required & gt;
I get the dome node by angular.element.find (document.querySelctor ('# dateDebut'))
;
angular Element (document.querySelctor ('# dateDebut')) controller ('ngModel')
- This will be given on the ngModelController
defined #dateDebut
element.
Here is plnkr:
No comments:
Post a Comment