Articles in this section
Category / Section

How to prevent double click action in Angular Button?

2 mins read

This article explains how to prevent the DoubleClick action in Button component. You can prevent the double-click action in the Button angular component by using the dblclick event.

HTML

<div class="col-xs-12 col-sm-12 col-lg-6 col-md-6">

<button #toggleBtn ejs-button cssClass="e-custom" [isPrimary]="true" (click)="btnClick()" >Play</button>

<button #toggleBtn ejs-button cssClass="e-custom" [isPrimary]="true" (click)="btnClicked()" >Pause</button>

</div> 

TS

export class AppComponent {

@ViewChild('toggleBtn')

public toggleBtnButtonComponent;

 

constructor() {}

@HostListener('dblclick', ['$event'])

clickEvent(event) {

event.srcElement.setAttribute('disabled'true);

}

//Toggle button click event handler

btnClick() {

console.log('Play button clicked once');

}

btnClicked() {

console.log('Pause Button clicked once');

}

} 

Refer to the working sample for additional details and implementation: Sample

Refer to the UG Documentation link: Documentation


Conclusion


We hope you enjoyed learning about how to prevent double click action in Angular Button.

You can refer to our Angular Button feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular Button example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsBoldDesk Support, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied