Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 (click) and (dblclick) on the same element not working good? [duplicate]

When I do this:

<div (click)="func1()" (dblclick)="func2()">Some text</h1>

I actually get "func1()" to fire even on dblclick twice.

How can I make it work on the same element and work good?

like image 478
Teddy Avatar asked Mar 20 '16 12:03

Teddy


1 Answers

Doesn't seem to be an Angular issue. See https://css-tricks.com/snippets/javascript/bind-different-events-to-click-and-double-click/

The workaround is to not process the click event when a dblclick happens shortly afterwards.

like image 128
Günter Zöchbauer Avatar answered Nov 05 '22 03:11

Günter Zöchbauer