Ionic triggers unwanted ng-click on right click and middle click
Asked Answered
D

1

8

I am using Ionic in the latest Chrome Version and Chrome canary for some very ODD reason Right click causes ng-click to trigger.

Code Pen demonstrating the issue

any one can shed some light ?

Drapery answered 23/11, 2016 at 8:16 Comment(4)
i have never seen like this....Comment
That's really strange, when you take a look at the event in IE console there's two event, one is a PointerEvent where you can detect which button of the mouse is clicked. In Chome, there's only a MouseEvent where the which property always = 1 (left click)Wardmote
Ionic is a framework for creating mobile apps. When you're using an app on a mobile phone, there is no left or right click, only a tap. Because of this, treating left and right clicks the same was probably a design decision.Grallatorial
add this data-tap-disabled="true" or use on-tap instead on ng-clickBynum
P
0

Change your Button tag by this,

 <button type="button" class="button button-large button-energized" ng-click="test()">click me!!!</button>

Or

<button type="button" class="button button-large button-energized" ng-click="test($event)">click me!!!</button>

and on your controller:

$scope.test = function($event){$event.preventDefault();alert(1);

Hope this helps.

Pram answered 23/12, 2016 at 6:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.