How to handle touchstart and touchend events?

Hi,
I’m developing an ionic2 APP in Typescript exclusively for iPad devices and I need to catch touchstart and touchend events.

I’ve been looking for this feature with no luck. Anyone knows how can I do it?

// this two buttons works fine
<button primary (tap)="foo()">onTap</button>
<button primary (click)="foo()">onClick</button>

// this two buttons doesn't work on real device
<button primary (mousedown)="foo()">onMouseDown</button>
<button primary (mouseup)="foo()">onMouseUp</button>

Thanks in advance.

Try this docs:

I had already read this documentation and believed that only allow tap, pinch, press, pan, swipe and rotate events.

This two buttons works fine on iPad:

<button large primary (touchstart)="foo($event);">touchstart</button>
<button large primary (touchend)="foo($event);">touchend</button>

Thanks @mauricionarcizo.

6 Likes

Hi, @Roman
do you use a visual drag&drop in your application? I try to drag an ion-card into an recycle bin.
Do you do something similar? Can you help me?
thx
Michael

Hi, @mburger81
I’m sorry, but I have not developed drag&drop functionallity in my application. Maybe you can use ng2dnd for this purpose (I never tied it).
There’s a demo.

Hope it helps you.

Okay thx, I know this lib, also as ng2-dragula.

So probably native drag&drop is not supported to ionic components?

thx
Michael

I do not think so. @mhartington maybe can help us.

Thx @ramon
In ionic1 there are sort-able ion-lists like described here
http://blog.scottlogic.com/2014/11/25/ionic-sorter.html

and on ionic2 there are a sliding ion-list, so I think for the ionic team there should be no problem do do a drag&drop for ionic components like ion-card or something like that

what do you think?