title: How to catch pattern error in input field in AngularJS?
body: <p>I built a function catch error but it works correctly only for standard HTML5 validation,if i use ng-pattern it cannot catch the error:( How can it be made? Maybe something like  <code>if(error.login$invalid)</code>.</p>
  
  <p>Template:</p>
  
  <pre><code>&lt;input type="text" name="login" class="form-input"
      ng-model="newUser.login"
      ng-pattern="loginPattern"
      required&gt;
  &lt;div class="error"
      ng-show="registrationForm.login.$invalid &amp;&amp; registrationForm.login.$dirty"&gt;
      {{getSigningError(registrationForm.login.$error)}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>$scope.getSigningError = function(error){
      if(angular.isDefined(error)){
          if(error.required){
              return "Field shouln`t be empty"
          }
          if(error.email){
              return "Enter correct email"
          }
          if(error.login){
              return "Enter correct login"
          }
      }
  }
  </code></pre>