Encountering an issue with the angular framework when trying to select a value from ng-for loop
<tr *ngFor="let dept of department" (click)="clinicChoose(dept)">
<td class="text-center">{{dept.sectionCode}}</td>
<td>{{dept.sectionName}}</td>
<td class="text-center" [style.color]="dept.flagStatus == 0 ? 'blue' : 'red'"></td>
</tr>
The clinicChoose function looks like this:
clinicChoose(dept: CSection) {
this.clinic = dept
}
Whenever I update the value in this.clinic
like this.clinic.flagStatus == 1
, the selected value in the table changes as well. I want to prevent this behavior, so what can I do?
Clicking on a row in the red table should display data in the green table https://i.sstatic.net/jOLia.jpg
But why does the selected data in the table change when I update something?