title: prevent entering same value for two fields angular 6
body: <p>I need to prevent entering same value for two different text boxes</p>
  
  <p>this is my code.</p>
  
  <pre><code>&lt;input type="text"  required [(ngModel)]="passwordModel.oldPassword" name="oldPassword" #oldPassword="ngModel" class="form-control" id="inputPassword" placeholder="Current Password"&gt;
  
  &lt;input type="text" (keydown)='ngModelChange()' required class="form-control" id="newinputPassword" [(ngModel)]="passwordModel.newPassword" name="newPassword" #newPassword="ngModel" placeholder="New Password"&gt;
  </code></pre>
  
  <p>function</p>
  
  <pre><code>checkModelVal() {
    this.oldPw = this.passwordModel.oldPassword,
    this.newPw = this.passwordModel.newPassword;
    if (this.oldPw === this.newPw ) {
      console.log('new and old password can not be same');
    }
  }
  </code></pre>
  
  <p>above code may be bad solution for the my requirement. if you know any better solution, please mention in the answer. thanks </p>