title: How can I simplify form validation?
body: <p>The code below seems to work pretty well for doing basic required form validation. </p>
  
  <p>The form displays a red <em>Name is required</em> message when the field is dirty + invalid and a <em>Great!</em> message if the field is dirty + valid.</p>
  
  <p>But it's a mess having repeat this code for each and every field in the form:</p>
  
  <pre><code>&lt;form name="myForm"&gt;
      &lt;div class="control-group" 
       ng-class="{error: myForm.name.$invalid &amp;&amp; myForm.name.$dirty}"&gt;
          &lt;label&gt;Name:&lt;/label&gt;
          &lt;input type="text" name="name" ng-model="user.name" required/&gt;
          &lt;span ng-show="myForm.name.$invalid &amp;&amp; myForm.name.$dirty" 
              class="help-inline"&gt;Name is required&lt;/span&gt;
          &lt;span ng-show="myForm.names.$valid &amp;&amp; myForm.names.$dirty"&gt;Great!&lt;/span&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I would like to be able to specify the <code>ng-show</code> and <code>ng-class</code> attributes in some easier way.</p>