I would like to validate email and phone based on the following:
If both email and phone are empty or the value containing them are not valid then both are invalid with
If you need access to the form in your directive, you need to require it:
require: ['^form', 'ngModel'],
link: function($scope, elem, attrs, ctrls) {
var form = ctrls[0];
var ngModel = ctrls[1];
if(form) {
// use form to get whatever it is you care about.
var whatever = form[otherProperty].$error.something;
}
}
So given the above, you should be able to pass the form controller into your custom validation methods as a third argument, and handle whatever you need.
I hope this helps.