title: How to send different parameters to same function for show/hide
body: <p>I have three password input box with buttons on click  I just need to show or hide the type of password(text or password) using fontawosme icon.</p>
  
  <p>Below is the code which I tried as the code:</p>
  
  <p>ts.file</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>changePasswordType(type) {
    if (type == 'oldPassword') {
      this.showPassword = !this.showPassword;
      this._pwdType = this.showPassword ? 'text' : 'password'
    } else if (type == 'newPassword') {
      this.newPassword = !this.newPassword;
      this._pwdType = this.newPassword ? 'text' : 'password'
    } else {
      this.confirmPassword = !this.confirmPassword;
      this._pwdType = this.confirmPassword ? 'text' : 'password'
  
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="form-group position-relative"&gt;
    &lt;label for="oldpassword" class="lable-title mb-0"&gt;Old Password&lt;/label&gt;
    &lt;input [type]="_pwdType" class="form-control" required name="old_password" [(ngModel)]="form.old_password" #old_password="ngModel" id="oldpassword"&gt;
    &lt;button class="position-absolute hide-password" *ngIf="!showPassword" (click)="changePasswordType('oldPassword')"&gt;
                &lt;i class="far fa-eye-slash"&gt;&lt;/i&gt;
              &lt;/button&gt;
    &lt;button class="position-absolute hide-password " *ngIf="showPassword" (click)="changePasswordType('oldPassword')"&gt;
                &lt;i class="far fa-eye"&gt;&lt;/i&gt;
              &lt;/button&gt;
  &lt;/div&gt;
  
  
  &lt;div class="form-group position-relative"&gt;
    &lt;label for="newpassword" class="lable-title mb-0"&gt;New Password&lt;/label&gt;
    &lt;input [type]="_pwdType" class="form-control" required name="password" [(ngModel)]="form.password" #password="ngModel" id="newpassword"&gt;
    &lt;button class="position-absolute hide-password" *ngIf="!newPassword" (click)="changePasswordType('newPassword')"&gt;
                &lt;i class="far fa-eye-slash"&gt;&lt;/i&gt;
              &lt;/button&gt;
    &lt;button class="position-absolute hide-password " *ngIf="newPassword" (click)="changePasswordType('newPassword')"&gt;
                &lt;i class="far fa-eye"&gt;&lt;/i&gt;
              &lt;/button&gt;
  &lt;/div&gt;
  
  
  &lt;div class="form-group position-relative"&gt;
    &lt;label for="conformpassword" class="lable-title mb-0"&gt;Confirm Password&lt;/label&gt;
    &lt;input [type]="_pwdType" class="form-control" required name="confirm_password" [(ngModel)]="form.confirm_password" #confirm_password="ngModel" id="conformpassword"&gt;
    &lt;button class="position-absolute hide-password" *ngIf="!confirmPassword" (click)="changePasswordType('confirmPassword')"&gt;
                &lt;i class="far fa-eye-slash"&gt;&lt;/i&gt;
              &lt;/button&gt;
    &lt;button class="position-absolute hide-password " *ngIf="confirmPassword" (click)="changePasswordType('confirmPassword')"&gt;
                &lt;i class="far fa-eye"&gt;&lt;/i&gt;
              &lt;/button&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>When the button is clicked then the all three input box converting to type text or else to password. I just need when I click on one button then only that button should show type text or password and icon should change respectively </p>