Angular4 is also given * ngFor tabloda is listed. I want to get 'ID' information from incoming data. How can I do that?
<tbody>
<tr *ngFor="let item of empleyoo">
<th scope="row" >{{item.Id}}</th> /*this row data get*/
<td>{{item.name}}</td>
<td>{{item.surname}}</td>
<td>{{item.code}}</td>
<button type="button" class="glyphicon glyphicon-check"></button>
</tr>
<tbody>
Typescript
public GetId()
{
var id=
}
Your question is not clear but I guess all you want is:
<tbody>
<tr *ngFor="let item of empleyoo">
<th scope="row" >{{item.Id}}</th> /*this row data get*/
<td>{{item.name}}</td>
<td>{{item.surname}}</td>
<td>{{item.code}}</td>
<button type="button" (click)="onSelect(item)"class="glyphicon glyphicon-check"></button>
</tr>
<tbody>);
onSelect(selectedItem: any) {
console.log("Selected item Id: ", selectedItem.Id); // You get the Id of the selected item here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With