Now this is a vary strange bug…
Using Ionic serve, everything works well but on Android device (this one has 4.4) the (click) button handler does not receive the event. Well, sometimes it does which makes it even more weird but most of the time, the event is just empty.
HTML:
<button ion-button class="col button" (click)="send($event)" id="b1">1</button>
<button ion-button class="col button" (click)="send($event)" id="b2">2</button>
<button ion-button class="col button" (click)="send($event)" id="b3">3</button>
TS:
send(event){
console.log(event.target.id);
}
Now I am hitting the buttons and the console output from the device looks like:
[app-scripts] [21:16:38] console.log:
[app-scripts] [21:16:46] console.log:
[app-scripts] [21:16:54] console.log:
[app-scripts] [21:16:56] console.log:
[app-scripts] [21:16:57] console.log:
[app-scripts] [21:16:57] console.log:
[app-scripts] [21:16:58] console.log:
[app-scripts] [21:16:58] console.log: b1
[app-scripts] [21:16:58] console.log:
[app-scripts] [21:16:59] console.log: b1
[app-scripts] [21:17:02] console.log:
[app-scripts] [21:17:02] console.log:
[app-scripts] [21:17:03] console.log: b3
[app-scripts] [21:17:04] console.log:
[app-scripts] [21:17:04] console.log: b2
[app-scripts] [21:17:05] console.log: b2
[app-scripts] [21:17:06] console.log:
[app-scripts] [21:17:06] console.log:
[app-scripts] [21:17:07] console.log:
[app-scripts] [21:17:08] console.log:
[app-scripts] [21:17:09] console.log: b1
Weird, isn’t it?
Also it seems to me (but I am not sure) that more quickly I press the buttons one after another, the greater probability that the send function will receive the argument.
//EDIT: Now I have tried also Windows x86 build and it behaves the same. Only it seems to me that it gets the event much more often (30%?). So it seems to be a Cordova issue…
So, any ideas?