我有一个包含数据的表格,而我的最后一个单元格是一个删除按钮,可以删除一行。Angular2可点击的表行,除了最后一个单元格
我面临的问题是,我的行是可点击的,它带我到另一个页面来编辑元素,所以当我点击删除按钮时,它删除元素,但也带我到编辑页面。
这里是我的代码:
<table class="data-table-format">
<thead>
<tr>
<th>id</th>
<th>Maker</th>
<th>Model</th>
<th>Year</th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let car of pagedItems" (click)="editCar(car)">
<th>{{ car.car_id }}</th>
<td>{{ car.car_maker }}</td>
<td>{{ car.car_model }}</td>
<td>{{ car.car_year }}</td>
<td><i class="material-icons" style="color:red" (click)="deleteCar(car.car_id)">delete_forever</i></td>
</tr>
</tbody>
</table>
如何与角/打字稿做什么建议吗?
你尝试过'event.stopPropagation();'? – echonax
是jQuery吗?我想避免jQuery,如果有可能 –
DUPLICATE问题[在这里回答](https://stackoverflow.com/questions/20300866/angularjs-ng-click-stoppropagation) –