I have a annoying problem regarding a click function in a list-item.
When testing in browsers, it always works. But when I test it in the emulator or on my device, 2 out of 3 clicks it doesn’t fire the click function. I tried long pressing, clicking fast, clicking on the text, at the beginning of the list item, at the end of the list item, it just doesn’t work always. There is no common rhythm to be found.
<ion-item *ngFor="let audience of audience" (click)="pushProfilesList(audience)" >
This is my list item. I tried using the click without the ngFor (just a hard coded list-title and amount), but there is still the same problem.
// alert ('Click fired!!');
This is my function. I also tried alerting, but still: in the browser it works all the time, but on my device or in the simulator it doesn’t always work. You have to click like 5 times, before the event is fired.
Any help is appreciated! Thanks.
Well, I have looked for the answer for over a week, and right after I’ve posted to the forum, I found my answer. For everybody who experienced the same “problem”, here’s the solution:
<button> with the styling of ion-item.
<button ion-item *ngFor="let audience of audience" (click)="pushProfilesList(audience)">
I am also facing the same issue, in list click doesn’t fire correctly. using button instead of ion-item is not good solution. In this case if I click item while scroll list, click get fired yet it should stop scroll.
This did not work for me either. I’ve only found that putting the (click)=“myFunction” in a span instead of a button or ion-item is the only thing that has worked in the emulator.
Nevermind, at one point I was trying to do something like:
To open a custom datepicker component that set a value for the input.
In reality, I just needed to use the (focus) event instead on the ion-input. This gave the behavior I needed.