# Ng-click fires twice in response to a single tap

**URL:** <https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585>\
**Category:** ionic-v1\
**Created:** [May 7, 2015, 11:21pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585 "2015-05-07T23:21:26Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![jasoncartermartin](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jasoncartermartin/32/68551_2.png) [@jasoncartermartin](https://forum.ionicframework.com/u/jasoncartermartin)\
**Post date:** [January 20, 2016, 10:36pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/21 "2016-01-20T22:36:03Z")

</div>

Yep! I encountered the same issue as you (tested with Ionic 1.1.1 to 1.2.4) — logging the event sent two Mouse events at the same coordinates (or offset slightly by 1px)…the only real difference was the timestamp!

**To fix in the meantime, I converted all of my “_ng-click_” to “_on-tap_” events…now, it’s working flawlessly.**

Would love to get a fix (and figure out why this is happening), but this workaround is doing the job in the meantime.

---

<div class="post-metadata">

**Author:** ![LouisR](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@LouisR](https://forum.ionicframework.com/u/LouisR)\
**Post date:** [January 21, 2016, 6:14pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/22 "2016-01-21T18:14:39Z")

</div>

Hey everybody,  
I opened an issue here about this: [https://github.com/driftyco/ionic/issues/5127](https://github.com/driftyco/ionic/issues/5127)

---

<div class="post-metadata">

**Author:** ![LouisR](https://avatars.discourse-cdn.com/v4/letter/l/9de053/32.png) [@LouisR](https://forum.ionicframework.com/u/LouisR)\
**Post date:** [January 23, 2016, 9:40pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/23 "2016-01-23T21:40:31Z")

</div>

and I made a codePen: [http://codepen.io/LouisDoe/pen/gPvGXe?editors=0100](http://codepen.io/LouisDoe/pen/gPvGXe?editors=0100) (run it twice to make it work)

---

<div class="post-metadata">

**Author:** ![arjenbroeze](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/arjenbroeze/32/94963_2.png) [@arjenbroeze](https://forum.ionicframework.com/u/arjenbroeze)\
**Post date:** [April 11, 2016, 8:48pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/24 "2016-04-11T20:48:19Z")

</div>

Had exactly the same issue. My back button does a save to the database which can take a few seconds. If this happens the back is fired twice. I think it’s related to the fact that the button will be disabled (if you disable a button on the ng-click, the event also fires twice - which is also a bug). The easiest solution for now is to use `<a>` instead of `<button>`. I’ve changed all my `<button></button>` tags to `<a></a>` tags and the problem is gone.

---

<div class="post-metadata">

**Author:** ![arx](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/arx/32/95159_2.png) [@arx](https://forum.ionicframework.com/u/arx)\
**Post date:** [May 16, 2016, 5:22pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/25 "2016-05-16T17:22:38Z")

</div>

I’m having the same problem, but changing `<button>` to `<a>` doesn’t help.

Is it legit to use `on-tap` instead of `ng-click`? It seems to work just fine, are there any drawbacks to this approach?

---

<div class="post-metadata">

**Author:** ![arjenbroeze](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/arjenbroeze/32/94963_2.png) [@arjenbroeze](https://forum.ionicframework.com/u/arjenbroeze)\
**Post date:** [June 6, 2016, 8:33am UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/26 "2016-06-06T08:33:09Z")

</div>

In the latest version of IONIC, changing `<button>` to `<a>` doesn’t work anymore. What I do now is define my own back-button instead of relying on the back-button provided by IONIC and build in logic to ignore the second click:

HTML:

```
<ion-nav-buttons side="left">
	<a class="button button-clear back-button header-item" ng-click="goBack()">
		<i class="icon ion-ios-arrow-back"></i>&nbsp;Back
	</a>
</ion-nav-buttons>

```

Controllers.js

```
$scope.$on('$ionicView.enter', function()
{
	$scope.active = true;
});

$scope.goBack = function()
{
	if ($scope.active)
	{
		$scope.active = false;
		// Do other stuff, like saving data to the database
		$ionicHistory.goBack();
	}
};

```

Kludgy, but it works.

---

<div class="post-metadata">

**Author:** ![1BJK903](https://avatars.discourse-cdn.com/v4/letter/1/9e8a1a/32.png) [@1BJK903](https://forum.ionicframework.com/u/1BJK903)\
**Post date:** [April 16, 2017, 1:32pm UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/27 "2017-04-16T13:32:06Z")

</div>

I had the exact problem as persyval and thanks to him, it’s solved.

> Adding data-tap-disabled=“true” to the button helps.

Thanks mate!

---

<div class="post-metadata">

**Author:** ![AnnaKaz](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@AnnaKaz](https://forum.ionicframework.com/u/AnnaKaz)\
**Post date:** [September 21, 2017, 11:58am UTC](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585/28 "2017-09-21T11:58:42Z")

</div>

it helps !🙂 thanks a lot!

[Previous page](https://forum.ionicframework.com/t/ng-click-fires-twice-in-response-to-a-single-tap/22585.md?page=1)
