Simulate a Tap on screen


Hi all,

I would like to simulate a Tap on screen by calling a function, without any changes in .html.
How would you call that function?

Thanks in advance,


What do you mean exactly ?

Do you want to execute a function when you open the page ?


This is What I have:

secondFunction(): Promise<{}> {
  return new Promise((resolve) => {
        console.log('I would like to have a simulated tap here!');

myFunction() {

let promises = new Array();

forkJoin(promises).subscribe((results) => {

This is what i want:
I would like to call myFunction with a button.
In the secondFunction, i would like to have a simulated Tap action.
So, with forkJoin, my app executes the firstFunction. After it has been executed, the secondFunction is fired up, which contains the simulated Tap/click on screen.


So you just want a Tap on the screen just add the click function to your HTML like this:

<ion-content (click)="tapSim()">
 //Your whole HTML Page
secondFunction(): Promise<{}> {
  return new Promise((resolve) => {


I think this is what you wanted, I hope :blush:

1 Like

Thank you very much Cherry!
Your method is working like a charm, but not with my intention.

Sorry to keep this from this issue, I thought this was circumstantial:
I need to simulate a Tap for surpassing “Touch to beam” message for Phonegap NFC plugin.
The problem is:
When i try to push a message, android beam comes up and requires the user to touch on screen in order to beam the message. I need to make my app as automatic as possible.

So this method is not working for my problem.
Still, i will mark your method as a solution.

If you know a workaround for my problem, i would really appreciate it - also, would donate kindly donate.


1 Like