当我单击按钮时,我希望它获取其所在行的信息。例如,当我单击第一行中的按钮时,我想获取该行的信息。我的网页如下
我的html代码
<table id="news">
<tr>
<th *ngFor="let col of headers">
{{col}}
</th>
</tr>
<tr *ngFor="let new of news">
<td *ngFor="let col of index">
{{new[col]}}
</td>
<td>
<button>Favorite</button>
</td>
</table>
答案 0 :(得分:0)
只需将参数“ new”作为参数传递给
aes_string
如果您在* ngFor中声明i = index,那么您也只能传递该列的索引
aes_string(x = "Global_Sales", y = input$dataset)
答案 1 :(得分:0)
<table class="table table-dark">
<thead>
<tr>
<th scope="col" *ngFor="let head of defaultTable.head">{{head}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let body of account ">
<td >{{body._id}}</td>
<td >{{body.EmailAddress}}</td>
<td >{{body.Phone}}</td>
<td >{{body.Street}}</td>
<td >{{body.City}}</td>
<td >{{body.State}}</td>
<td *ngIf="show">Dactive</td>
<td *ngIf="!show">Dactive</td>
<td ><button (click)="Update(body._id)" >Update</button>
<button (click)="delete(body._id)" >Delete</button></td>
</tr>
</tbody>
</table>