title: ng-class not adding has-error when error in input field
body: <p>I'm trying to perform simple form validation. I'm using required and ng-minlength conditions on my fields and ng-messages to display the error messages. the error messages should display only when user access the input field. But I do not see any error messages appearing. When I examined using chrome developer tools, I found the classes on the input field are changing but the 'has-error' class is not being added on the other <code>div</code> elements that are checking for this condition. </p>
  
  <p><img src="https://i.stack.imgur.com/hUoQ8.png" alt=""> this is when the application got loaded.</p>
  
  <p><img src="https://i.stack.imgur.com/qPGfF.png" alt=""> this is when I clicked the username field and left the field without giving any data. Please observe the classes of the elements marked in red boxes. I'm not getting any errors displayed. What might the issue be?</p>
  
  <p><a href="https://i.stack.imgur.com/mCcIw.png" rel="nofollow">1</a> this is the ng-messages code snippet that i'm using</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form role="form" name="userForm" novalidate class="container-fluid"&gt;
                &lt;div class="margin-bottom" ng-class="{'has-error' : userExists.notAvailable , 'has-error': userForm.username.$touched &amp;&amp; userForm.username.$invalid}"&gt;
                  &lt;label for="email"&gt;username&lt;/label&gt;
                  &lt;input class="form-control" type="text" placeholder="UserName" name="username" ng-blur="checkingUser($event)" ng-model="username" required ng-minlength="4"&gt;
                  &lt;div ng-messages='userExists'&gt;
                     &lt;div ng-message='error'&gt;Error!&lt;/div&gt;
                     &lt;div class="form-group" ng-message='notAvailable' class="has-error"&gt;Username already exists. Please choose a different username!!&lt;/div&gt;
                 &lt;/div&gt;
  
                 &lt;div class="help-block" ng-messages="userForm.username.$error" ng-show="userForm.username.$touched" ng-class="{'has-error': userForm.username.$touched &amp;&amp; userForm.username.$invalid}"&gt;
                    &lt;div class="form-group" ng-message='required' class="has-error"&gt;Username cannot be empty&lt;/div&gt;
                    &lt;div class="form-group" ng-message='minlength'&gt;minimum 4 charcters&lt;/div&gt;
                &lt;/div&gt;
                  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>