hussain hussain - 2 months ago 7
Javascript Question

How to invoke method on double click in angularJs?

I have a list of files populated in modal window when user click on file i have invoked

downloadServerFile
method that is happening on single click , How can i invoke this method on double click using AngularJs ?

main.html

<td ng-click="downloadServerFile(file.filename)" class="noBorder"><span class="glyphicon glyphicon-file"></span>{{file.filename}}
<span class="pull-right text-danger" style="padding-left: 25px" ng-if="file.mostRecent">*</span></td>

Answer

you can use ngDblclick instead of ng-click which will allows you to specify custom behavior on a dblclick event.

 <td ng-dblclick="downloadServerFile(file.filename)" class="noBorder"><span class="glyphicon glyphicon-file"></span>{{file.filename}}                       <span class="pull-right text-danger" style="padding-left: 25px" ng-if="file.mostRecent">*</span></td>

DEMO APP

Comments