I am starting with angular2 and ionic2;
In ionic2, I have a button that will call a method of my component. Like this:
<button secondary clear large>
</button>
Should I use (click)
- angular2 OR (tap)
- ionic2?
Like this:
(click)
<button secondary clear large (click)="pause()">
</button>
(tap)
<button secondary clear large (tap)="pause()">
</button>
There are some difference? You can see about (tap)
in
http://ionicframework.com/docs/v2/components/#gestures
Thx.
If making mobile apps, (tap)
might be better. This is because when using (click)
the action always executes, even when tapping accidently. The (tap)
won't execute if the user holds it for a longer period. And if you want to have a button that needs to be clicked for a longer period of time you can use the (press)
.
Note that in some ionic versions the (click)
event won't execute on iOS. Therefore using (tap)
would be the recommended solution.