It is recommended to use click event only on clickable elements like button or/and on anchor tags. If you use click event on any other tags(apart from button or anchor tag) there will be some kind of jerkiness or delay of 300 milliseconds.
Related Read:
Passing Data Between Pages: Ionic 2
Tappable Attribute: Ionic 2
[youtube https://www.youtube.com/watch?v=d1DzlKu6sUQ]
src/home/home.html
< ion-list> < ion-item *ngFor="let Company of companies" (click)="detailsPage(Company.code);" tappable> {{Company.name}} < /ion-item> < /ion-list> |
Solution
Add tapabble attribute if you’re using click event on elements other than button or an anchor tag. In our example we are using click event on ion-item element, so adding tapabble attribute would speed up the firing of click event by 300 milliseconds.
In today’s performance centric application development 300 milliseconds delay shouldn’t be neglected. Hope this small tip helps in improving the usability of your mobile application.
Thank you Satish given a wonderful tips and it help us lot improving the performance Great :)
Happy to know that it helped :)
Ionic2 RC3 has introduced tappable by default to ion-item controls
check: https://github.com/driftyco/ionic/commit/5c4838b
@Arun, Glad they’ve introduced it. Anyway tapabble attribute would help when we’ve click event of other elements like div span etc.