Answer the question
In order to leave comments, you need to log in
How can I support ngMessage in a directive if the form element is not an input?
I have a form element. This is such a file loader. It's a whole little component. But as a directive.
<div s3 options="options" ng-model="form.files"></div>
ngModel.$setValidity('upload', false);
<div ng-messages="testForm.upload.$error">
Answer the question
In order to leave comments, you need to log in
ngMessages stupidly takes the expression that you feed it.
form registers controls and takes their name from the $name property, which by default is taken from the name attribute .
Conclusion, you can:
- add the name or data-name attribute
- set the name of the control yourself using ngModelController
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question