title: Angular form validation with disabled field
body: <p>I have an Angular validation scenario where a field needs to be valid unless it is disabled, in which case it should be ignored. </p>
  
  <p>(I am using <code>ng-messages</code> for demo purposes, it doesn't affect the <code>$errors</code> state of the form / field).</p>
  
  <p>How do we clear <code>max</code> and <code>required</code> errors when the field is disabled?</p>
  
  <pre><code>&lt;form name="myForm"&gt;
    &lt;label&gt;&lt;input type="checkbox" ng-model="disable"&gt; disable field&lt;/label&gt;&lt;br&gt;
  
    &lt;input name="width" type="number" ng-disabled="disable" ng-disabled="disable" ng-model="someValue" max="100" required&gt;
  
    &lt;div class="errors" ng-messages="myForm.width.$error"&gt;
      &lt;div ng-message="required"&gt;Please enter a width&lt;/div&gt;
      &lt;div ng-message="max"&gt;Width is over the max permitted&lt;/div&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><p>myForm.$valid = {{ myForm.$valid }}</p></p>
  
  <p>Here is a working example on JS Bin: <a href="http://jsbin.com/supapotoci/1/edit?html,output">http://jsbin.com/supapotoci/1/edit?html,output</a></p>