How can I change its class if by (click) event only with that element only if I have multiple (click) event with the same name? Is this possible? (see code below)
Or should I differentiate its (click) event name? Isn`t it redundant?
HTML
<mat-form-field class="col-md-12">
<label><i class="fa fa-lock"></i> CURRENT PASSWORD</label>
<input matInput type="password" name="current_password">
<i class="fa right" [ngClass]="{'fa-eye': !displayPassword, 'fa-eye-slash': displayPassword}" (click)="showPassword($event)"></i>
</mat-form-field>
<mat-form-field class="col-md-12">
<label><i class="fa fa-lock"></i> NEW PASSWORD</label>
<input matInput type="password" name="new_pass">
<i class="fa right" [ngClass]="{'fa-eye': !displayPassword, 'fa-eye-slash': displayPassword}" (click)="showPassword($event)"></i>
</mat-form-field>
<mat-form-field class="col-md-12">
<label><i class="fa fa-lock"></i> CONFIRM NEW PASSWORD</label>
<input matInput type="password" name="con_new_pass">
<i class="fa right" [ngClass]="{'fa-eye': !displayPassword, 'fa-eye-slash': displayPassword}" (click)="showPassword($event)"></i>
</mat-form-field>
TS
public displayPassword = false;
showPassword(event){
if(event.displayPassword == false){
event.displayPassword = true;
}else{
event.displayPassword = false;
}
}
classof the element you clicked, right?