还给出了Angular4 * ngFor tabloda列出。我想获得ID'来自传入数据的信息。我怎么能这样做?
TNat . Typ4 ::= "nat" ;
TVoid . Typ4 ::= "<>" ;
TProd . Typ3 ::= SumType;
TProd . Typ2 ::= Typ2 "*" Typ3;
TArrow . Typ1 ::= Typ1 "->" Typ2;
coercions Typ 4;
打字稿
<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>
答案 0 :(得分:6)
你的问题不明确,但我想你想要的只是:
<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
}