Ion-content swipeEvent

Hi,
I can’t intercept the swipe event in a ion-content div:

<ion-content padding-bottom class=“home” (swipe)=“swipeEvent($event)”

Why? What is the correct way?

Hi, see if this is any help.

Thx, but I think that my problem is related to this issue:

I think it is because you are using it in the ion-content
This worked for me…in the html.

  <ion-card (swipe)="swipeEvent($event)">
    <ion-item>
      Swiped: {{swipe}} times
    </ion-item>
  </ion-card>

in .ts

public swipe: number = 0;

  swipeEvent(e) {
    this.swipe++
  }

Yes, with ion-card I have not problems. The problem is the ion-content.

Yes, I do not think (swipe)="swipeEvent($event) works in the ion-content. You will have to use another directive.
But an alternative is to create a div inside the ion-content and insert your content inside the div.

<ion-content>
  <div (swipe)="swipeEvent($event)">
    Content...
  </div>
</ion-content>

.ts

   swipeEvent(e) {
    console.log('swiped');
  }
5 Likes