我想让一个子元素触发它自己的点击,并且不响应它具有[routerLink]的父元素,问题是子元素无法在其中运行它delete()
的功能,(click)="delete()"
只需跟随它的父元素[routerLink]
(它导航到 /product/:id)
<div class="item">
<!-- parent element -->
<a [routerLink]="['/product/'+product.id]">
<div class="figure">
<div class="sides">
<div class="side">
<div class="card">
<img class="img" [src]="product.thumb">
<div class="content">
<div class="header">{{product.name}}</div>
<div class="meta"> <span>product.category</span> </div>
</div>
<div class="extraContent"> <span class="ui right floated black">
<!-- child element -->
<a (click)="delete()" ><i class="red trash outline icon"></i></a></span> <span><i class="deleteProductIcon"></i></span> </div>
<!-- child element -->
</div>
</div>
</div>
</div>
</a>
<!-- parent element -->
</div>
我试图移动[routerLink]
到鞋面div
,但它仍然做同样的行为