title: AngularJS NgMessages does not hide messages
body: <p>I'm new to AngularJS so this might be a pretty stupid question.</p>
  
  <p>By using the <a href="https://docs.angularjs.org/api/ngMessages/directive/ngMessages" rel="nofollow noreferrer">Angular documentation on ngMessages</a> , I'd like to implement message boxes that are displayed when certain requirements are met.</p>
  
  <p>However, even when using the copy-pasted example, the message boxes are not hidden even if their requirements are not met. The <code>$error</code> variable does show the correct values, though.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>angular.module('ngMessagesExample', ['ngMessages']);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.1/angular.min.js"&gt;&lt;/script&gt;
  &lt;form name="myForm"&gt;
      &lt;label&gt;
          Enter your name:
          &lt;input type="text" name="myName" ng-model="name"  ng-minlength="5" ng-maxlength="20" required /&gt;
      &lt;/label&gt;
      &lt;pre&gt;myForm.myName.$error = {{ myForm.myName.$error | json }}&lt;/pre&gt;
  
      &lt;ng-messages for="myForm.myName.$error" style="color:maroon;" role="alert"&gt;
          &lt;ng-message when="required"&gt;You did not enter a field&lt;/ng-message&gt;
          &lt;ng-message when="minlength"&gt;Your field is too short&lt;/ng-message&gt;
          &lt;ng-message when="maxlength"&gt;Your field is too long&lt;/ng-message&gt;
      &lt;/ng-messages&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is what it looks like:
  <a href="https://i.stack.imgur.com/ZU8VA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZU8VA.png" alt="enter image description here"></a></p>