Customized Template,
<div *ngFor="let item of items" class = "col-sm-12 nopadding">
<a class="button buttonaquacss button-mini button-aqua
text-right pull-right" [ngClass]="{activec: isActive}"
(click)='updateStatus(item)'
#btnElement [ngStyle]="{'background-color': backgroundColor}">{{buttonLabel}}
</a>
</div>
My custom TypeScript code,
buttonLabel = 'connect';
updateStatus(button): void {
this.http.post('http://localhost:3000/updatestatus', formdata, { headers: headers })
.subscribe(
response => {
if (response.json().status == 'success') {
this.isActive = true;
this.backgroundColor = 'blue';
}
});
}
The issue occurs when clicking one button affects all buttons, seeking suggestions to resolve the problem.