Angular 7 single click and double click events

9,414 views
Skip to first unread message

rj

unread,
Feb 12, 2019, 8:55:03 PM2/12/19
to Angular and AngularJS discussion
My table row is configured like below,

<tr *ngFor="let v of mf.data | sortgrid: '-lastheartbeat'; index as i"
[class.table-success]="venuesRunning[i]" [routerLink]="['/invoices', v.userid]"
>
The above code snip works for a single click on the row.

I tried to associate double clink on the above code
<tr *ngFor="let v of mf.data | sortgrid: '-lastheartbeat'; index as i"
[class.table-success]="venuesRunning[i]" [routerLink]="['/invoices', v.userid]"
(dblclick)="somefunction()">

But now also, only single clink works.

Double click worked when [routerlink] was removed. 
<tr *ngFor="let v of mf.data | sortgrid: '-lastheartbeat'; index as i"
[class.table-success]="venuesRunning[i]"
(dblclick)="somefunction()">

What should i do achieve both single click and double clink functionality in Angular7 ?


Tito

unread,
Feb 12, 2019, 9:00:46 PM2/12/19
to Angular and AngularJS discussion
why do you want a double click in a web application?

rohit jagannath

unread,
Feb 12, 2019, 9:03:07 PM2/12/19
to ang...@googlegroups.com
I need to show two different views. One for single click and other for double click.

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Sander Elias

unread,
Feb 12, 2019, 10:28:04 PM2/12/19
to Angular and AngularJS discussion

Hi Rj,

Then you can’t use routerlink, but you should be using the router in your event handlers.

singeClick(rowData) { this.router.navigate(['routesng',rowData.x])};
doubleClick(rowData) { this.router.navigate(['routesdbl',rowData.x])};

something like that should do the trick.

Regards
Sander

Reply all
Reply to author
Forward
0 new messages