title: Add a custom validation using Angular Auto Validate
body: <p>First, I'm using <a href="http://jonsamwell.github.io/angular-auto-validate/" rel="nofollow"><strong>Angular Auto Validate</strong></a> and it's working as expected, but I want to add a custom validation to compare passwords.</p>
  
  <p>Here's my code actually:</p>
  
  <pre><code>&lt;form role="form" name="changePasswordForm" novalidate="novalidate" ng-submit="changePassword()"&gt;
    &lt;div class="box-body"&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="oldPassword"&gt;Old Password&lt;/label&gt;
        &lt;input type="password" class="form-control" id="txtOldPassword" name="oldPassword" ng-model="data.oldPassword" placeholder="Old password" required="required" ng-pattern="/^[A-Za-z]+$/" ng-minlength="6" ng-maxlength="10" ng-pattern-err-type="badOldPassword"&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="newPassword"&gt;New Password&lt;/label&gt;
        &lt;input type="password" class="form-control" id="txtNewPassword" name="newPassword" ng-model="data.newPassword" placeholder="New password" required="required" ng-pattern="/^[A-Za-z]+$/" ng-minlength="6" ng-maxlength="10" ng-pattern-err-type="badNewPassword"&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
        &lt;label for="confirmNewPassword"&gt;Confirm New Password&lt;/label&gt;
        &lt;input type="password" class="form-control" id="txtConfirmNewPassword" name="confirmNewPassword" ng-model="data.confirmNewPassword" placeholder="Confirm new password" required="required" ng-pattern="/^[A-Za-z]+$/" ng-minlength="6" ng-maxlength="10" ng-pattern-err-type="badConfirmNewPassword"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- /.box-body --&gt;
    &lt;div class="box-footer"&gt;
      &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  
  var userApp = angular
    .module("userModule", ['jcs-autoValidate'])
    .run(function(defaultErrorMessageResolver) {
      defaultErrorMessageResolver.getErrorMessages().then(function(errorMessages) {
        errorMessages['badOldPassword'] = 'Old password must contain only alphabets.';
        errorMessages['badNewPassword'] = 'New password must contain only alphabets..';
        errorMessages['badConfirmNewPassword'] = 'Confirm password must contain only alphabets.';
      })
    })
    .controller('userController', function($scope, $http, $log) {
      $scope.data = {};
  
      $scope.changePassword = function() {
        alert('form submitted');
      }
    });
  </code></pre>