title: Angularjs : display message
body: <p>i'm try to display message when password don't match but not not showing any idea ?i'm try to display message when password don't match but not not showing any idea ?</p>
  
  <p><strong>directive:</strong></p>
  
  <pre><code>angular.module('crud')
    .directive('equal', function () {
      return {
        require: 'ngModel',
        scope: {
          equal: '='
        },
        link: function(scope, elem, attrs, ctrl) {
  
          ctrl.$validators.equal = function(modelValue, viewValue) {
            return modelValue === scope.equal;
          };
  
          scope.$watch('equal', function(newVal, oldVal) {
            ctrl.$validate();
          });
        }
      };
    });
  </code></pre>
  
  <p><strong>html</strong></p>
  
  <pre><code>&lt;form name="userForm"  ng-submit="signup()" class="form-horizontal" role="form" &gt;
      &lt;input type="password" class="form-control ng-invalid submitted" id="password" name="password" ng-model="password" ng-minlength="8" ng-maxlength="20"  required /&gt;
  
       &lt;input type="password" equal="password" class="form-control  ng-invalid submitted" id="confirmPassword" name="confirmPassword" ng-model="confirmPassword" required  /&gt;
  
      &lt;span  ng-show="userForm.password.$error.equal &amp;&amp; userForm.password.$dirty"&gt;Passwords don't match.&lt;/span&gt;
  &lt;/form&gt;
  </code></pre>