How prevent click in event press Gestures Ionic2?


#1

I’m trying to implement a press option on a button that already has a click event.

Is it possible to avoid click if the press occurs?

For in my tests the click is triggered even if the press has happened before. I tried to include event.preventDefault() in press event.

Example in Plunker


#2

I had the same problem. When I launched a popover from the press event, the event didn’t fall down to the click handler. But on all other cases it did. In those cases, I use tap instead of click:

page.html:

<button ion-button full  color="primary" (press)="onPress($event)" (tap)="onTap()">click me</button>

page.ts:

onTap() {
    console.log('tapped');
}
onPress($event) {
    console.log('pressed');
}

#3

Thank you, that solved my problem!

If you are interested in replying too, I opened a post on this also in stackoverflow before receiving your answer here!