I have multiple button im trying to disable the button after getting the response.Im using ngClass to disable the button after the getting the response
<tr *ngFor="let item of data">
<td>{{item.username}}</td>
<td>{{item.name}}</td>
<td>{{item.email}}</td>
<td>{{item.phone}}</td>
<td><button type="button" [ngClass]="{disabled : item.username === name }" (click)="changestatus(item.username)" class="btn btn-success btn-xs" >Change Status</button></td>
</tr>
And my changestatus function
public name : string ;
changestatus(username : string){
this.httpService.changeuserstatus({uname : username }).subscribe(data => {
this.name = (data.data == 1) ? username : "no";
})
}
im assigning the username value to the name variable and if both matches i will disable the button
The problem is if i click the 1st button after the getting response it is disabled but when i click the 2nd button the after getting response 1st button is enabled and the 2nd button becomes disabled.But the thing is need to disable both buttons. Help me thanks in advance