I am new to angular. I want to visible button of save and cancel on checkbox change event for that particular row in table. How can I set that. I am using following code :
<tr *ngFor="let configuration of configurationList;">
<td>{{configuration.label}}</td>
<td class="text-center">
<mat-checkbox color='primary' name="{{configuration.id}}" [checked]="configuration.data" [(ngModel)]="configuration.data"
(change)="onCheckedChange($event,configuration)"></mat-checkbox>
</td>
<td class="text-center">
<div class="action-wrap" *ngIf="configuration.isEdit">
<a href="javascript:void(0);" class="icon-grid-edit p-10" matTooltip="Update!" (click)="update(configuration)">
<i class="fa fa-check"></i>
</a>
<a href="javascript:void(0);" class="icon-grid-delete p-10" matTooltip="Cancel!" (click)="cancel(configuration)">
<i class="fa fa-times"></i>
</a>
</div>
</td>
</tr>
both tag will be visible when checkbox is change and only for those row. otherwise both are hidden. If I am selecting first row checkbox and then after select second row checkbox then button are visible for second row only.
Actually data is used for display checkbox checked or not when first time load. So it will display button on already selected checkbox.
If checkbox is change then and then button will be visible.
My event code is :
onCheckedChange(event,configuration) {
configuration.isEdit=true;
}
cancel(configuration) {
this.configurationList.forEach(item => {
item.isEdit = false;
}
);
Thank you.