How to fire click event programmatically in Ionic?


#1

Helo community.

I want to trigger programmatically in Ionic a click event on a Ionic button:

.<button id=“facebookLogin” ion-button color=“facebook” full (click)=“signInWithOAuth(‘Facebook’)”>

I tried with JQuery:

$("#facebookLogin").trigger(“click”);
$("#facebookLogin").click()

I tried to fire a Mouse with Javascript: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent

I tried to do like in Angular 2 https://stackoverflow.com/questions/36639486/angular2-manually-firing-click-event-on-particular-element

I get no error. Just the event is not triggered (it is swallowed by the Ionic button)
Any idea how can I do this?
I use Ionic 3.12.0


#2

Why don’t you just execute the signInWithOAuth('Facebook") function from your code?