Here is the HTML code:
<tr *ngFor="let item of items">
<td #id>{{item.id}}</td>
<td>{{item.comment}}</td>
<td> <i class="fa fa-trash-o" aria-hidden="true" (click)="deleteTime(id.value)"></i></td>
</tr>
DeleteTime method explained in the component:
deleteTime(id_value) {
let id = id_value;
var arg= {
"id": id
};
this.myService.deleteTime(arg).subscribe();
}
While I have successfully created my html elements and the deleteTime button click event successfully activates when the user clicks the image, the issue arises where id.value returns as undefined. This prevents me from deleting the intended item. The problem seems to be related to how I am retrieving the value of #id td. Despite trying various methods such as passing {{item.id}} in the clickevent, each attempt resulted in a syntax error.