title: How to add custom validation to an AngularJS form?
body: <p>I have a form with input fields and validation setup by adding the <code>required</code> attributes and such. But for some fields I need to do some extra validation. How would I "tap in" to the validation that <code>FormController</code> controls? </p>
  
  <p>Custom validation could be something like "if these 3 fields are filled in, then this field is required and needs to be formatted in a particular way".</p>
  
  <p>There's a method in <code>FormController.$setValidity</code> but that doesn't look like a public API so I rather not use it. Creating a custom directive and using <code>NgModelController</code> looks like another option, but would basically require me to create a directive for each custom validation rule, which I do not want.</p>
  
  <p>Actually, marking a field from the controller as invalid (while also keeping <code>FormController</code> in sync) might be the thing that I need in the simplest scenario to get the job done, but I don't know how to do that.</p>