You can solve this issue by using event.stopPropagation();
.
Please take a look at this plunker.
like you can see there, I also send the $event
object to both methods
<ion-list>
<ion-item *ngFor="let item of items" (click)="open($event, item)">
{{ item }}
<ion-icon (click)="download($event, item)" item-right name="download"></ion-icon>
</ion-item>
</ion-list>
And then I use that information to stop the propagation of the event, so only the download method will be executed when clicking the download icon
public open(event, item) {
event.stopPropagation();
alert('Open ' + item);
}
public download(event, item) {
event.stopPropagation();
alert('Download ' + item);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…