Ng-click fires twice on button

I tested with all releases > 1.0.0 and found that click event fires twice.

<div class="buttons">
   <button class="button button-positive" ng-click="c=c+1" ng-init="c=0">
</div>

If you simply change release to 0.97, and nothing else, the problem vanishes.

What happens? Does the count increment twice?

Yes, but there’s an update, as of a few minutes ago. I have found that it happens only when you are in Ripple under Chrome and especially when the developer tools window is active. If you disable it, the problem vanishes by itself.

It sounds weird, doesn’t it? Until I was using version 0.9.27 of Ionic nothing like that had ever happened. But, as soon as I have passed to v. > 1.0.0 the problem arises and it is bothering as well. Hope it’ll be cleared off at the soonest :wink:

Thanks

I am also having this same issue. Really causing issues with submitting forms.

Any updates on this? Every single button I click on, fires twice. I have alerts set up, and I am noticing that the second time it fires, the data changes or is no longer there. Also sometimes it waits to fire until I click on another button, then the previous button’s alert fires then I have to re click on the second button.

Hmm, not sure what was going on here. But I haven’t had any issues with ng-click in beta 6/ nightly builds. Give them a shot

I’m using beta.6 and still seeing this issue.

I’m totally new to Ionic but moderately experienced with angular, and I’ve barely departed from the tutorial that uses the stateProvider and ion-nav-view.

Any chance you could put together a codpen or plnkr?

@colllin

Do you load angularjs and ionic.bundle in your app?

I noticed that behaviour if you load angularjs twice.

Greets, bengtler.

1 Like

I made a plnkr. Unfortunately the plnkr doesn’t reproduce the issue. So then I tried running my local app on node http-server, and it doesn’t reproduce there either. It must only happen in iOS emulator, not in the browser. I bet if you copy my code and build it locally and run it on the iOS emulator, you will see it.

http://embed.plnkr.co/K0XAtChQvFvtaIGn8Kuf/preview

Thanks for the tip. I don’t think this is the issue. This plnkr includes the same files I’m including:

http://embed.plnkr.co/K0XAtChQvFvtaIGn8Kuf/preview

Hi guys,

I just noticed this same problem in the following setup:
Ionic 1.2.0 > Deploying on Windows 8 with Button elements that do not have a Type attribute.

As soon as I add the type=“button” or type=“submit” attribute the problem goes away.

Martin

1 Like

Just had the same issue on ionic 1.2.4 on iphone 4, ios 7.1.2.

Does anybody has a workaround?