title: Compare password in angular reactive forms
body: <p>For compare password, I am using rxwebvalidators and it is working fine when I enter the value in password field after that confirmPassword field. If the confirmPassword field value is incorrect while entering the text then the FormControl become invalid.</p>
  
  <p>But the problem is if the both controls have same value and I change the value in password field then confirmPassword field will not be invalid. But in actual case It must be invalid.</p>
  
  <p>I tried in my local project and also create a small replica on stackblitz for you reference : <a href="https://stackblitz.com/edit/angular-nriznm?file=src%2Fapp%2Fapp.component.ts" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-nriznm?file=src%2Fapp%2Fapp.component.ts</a> </p>
  
  <p>I do the following:</p>
  
  <pre class="lang-js prettyprint-override"><code>    this.userForm = this.formBuilder.group({
        password:[''],
        confirmPassword:['',RxwebValidators.compare({fieldName:'password'})]
      })
  </code></pre>
  
  
  
  <p>Below is my html code :</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form [formGroup]="userForm"&gt;
   password &lt;input type="text" formControlName="password"/&gt;&lt;br/&gt;
    compare password &lt;input type="text" formControlName="confirmPassword"/&gt;
    {{userForm.controls.confirmPassword.errors | json}}
  &lt;/form&gt;
  </code></pre>
  
  
  
  <p>I have spend more than hour to identify the cause, but no success. Please help where I am doing wrong. It's working on rxweb.io site :  <a href="https://rxweb.io/form-validations/compare/validators#basiccomparevalidation" rel="nofollow noreferrer">https://rxweb.io/form-validations/compare/validators#basiccomparevalidation</a></p>