2017-09-15 2 views
0

Angular4 ist auch gegeben * ngFor Tabloda aufgeführt ist. Ich möchte ID-Informationen von eingehenden Daten erhalten. Wie kann ich das machen?Angular erhalten die Daten der ausgewählten Zeile in der Tabelle

<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> 

Typoskript

public GetId() 
{ 
    var id= 
} 

Antwort

0

Ihre Frage ist nicht klar, aber ich denke, alles, was Sie wollen, ist:

<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 
} 
+0

durch das Problem gelöst ist. –

Verwandte Themen