我通过使用定位标记使整个li元素可点击:
<li *ngIf="notification.payload.table">
<a class="d-flex justify-content-between" (click)="updateTableNotificationReadStatus(notification)">
<div class="d-flex flex-column">
<span style="font-size: 1.1rem">
<strong>{{notification.payload.username}}</strong> requested access for table - {{notification.payload.table}}.
<span style="font-size: 0.9rem">{{notification.payload.time}}</span>
</span>
<span *ngIf="notification.payload.note"class="note">
<span class="noteLabel">Note</span>
<span> This is a note attached to it</span>
</span>
</div>
<span>
<fa-icon [icon]="faClose" class="ml-auto" (click)="deleteNotification(notification)"></fa-icon>
</span>
</a>
</li>
当我单击fa-icon时,通知将被删除,但由于我不想要的功能,我也将重定向到另一个页面?
如何使关闭图标可点击,而在同一元素上却不会被重定向?
答案 0 :(得分:1)
答案 1 :(得分:0)
我使用以下方法实现了这一点:
deleteNotification(e, notification) {
e.stopPropagation();
}