問題:
I have a click Event on a table row and in this row there is also a delete Button with a click Event.我在表格行上有一個點擊事件,在這一行中還有一個帶有點擊事件的刪除按鈕。 When i click the delete button the click Event on the row is also fired.當我單擊刪除按鈕時,該行上的單擊事件也會被觸發。
Here is my code.這是我的代碼。
<tbody>
<tr ng-repeat="user in users" class="repeat-animation" ng-click="showUser(user, $index)">
<td>{{user.firstname}}</td>
<td>{{user.lastname}}</td>
<td>{{user.email}}</td>
<td><button class="btn red btn-sm" ng-click="deleteUser(user.id, $index)">Delete</button></td>
</tr>
</tbody>
How can I prevent that the showUser
Event is fired when i click the delete Button in the table cell?當我單擊表格單元格中的刪除按鈕時,如何防止觸發showUser
事件?
解決方案:
參考一: https://en.stackoom.com/question/1NBBK參考二: https://stackoom.com/question/1NBBK