Reputation: 973
I have a custom form control (a directive which is not an input element) which implements ng-model (as suggested here) and it works fine. Validation is triggered on the form submit and the directive is made valid/invalid correctly.
The problem is how to display an error message. I tried like for normal form input fields:
ng-show="form.fieldName.$error.required"
but I cannot access field through name. form.fieldName is undefined.
Upvotes: 0
Views: 149
Reputation: 973
Actually the problem was with transclusion. Once I fixed it element was normally accessible through the name.
Upvotes: 0
Reputation: 345
Please make sure that you defined your form name inside of form tag. After that try to print formname.fieldname
Upvotes: 0