0

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.

1
  • Please provide a sample of your code... which reproduces your issue Commented Feb 15, 2016 at 13:34

2 Answers 2

0

Please make sure that you defined your form name inside of form tag. After that try to print formname.fieldname

Sign up to request clarification or add additional context in comments.

Comments

0

Actually the problem was with transclusion. Once I fixed it element was normally accessible through the name.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.