当用户单击文件时,我有一个填充在模态窗口中的文件列表我已经调用了单击时发生的downloadServerFile
方法,如何使用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>
答案 0 :(得分:2)
您可以使用ngDblclick
代替ng-click,这样您就可以在dblclick事件上指定自定义行为。
<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>
答案 1 :(得分:0)
使用ng-dblclick
angular指令而不是ng-click。您可以查看文档here
<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>
答案 2 :(得分:0)
你可以使用ng-dblclick
<element ng-dblclick="expression"></element>
<div ng-controller="SampleController">
<a ng-dblclick="showAlert()">Double Click Here </a>
</div>
app.controller('SampleController', ['$scope', function ($scope) {
$scope.showAlert = function () {
alert("This is an example of ng-dblclick");
}
}]);