2016-09-13 6 views
1

ファイルをクリックしたときにモーダルウィンドウにファイルリストが表示されました。私はdownloadServerFileメソッドを呼び出しました.AngularJsをダブルクリックしてこのメ​​ソッドを呼び出すにはどうすればよいですか?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> 

答えて

2

をチェックすることができますが、DBLCLICKイベントのカスタム動作を指定することを可能にするだろうNGクリックします。

<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

0

使用ng-dblclick角度指令の代わりに、NG-クリック。あなたがするのではなく、ngDblclickを使用することができますドキュメントに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> 

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"); 
    } 
}]); 
関連する問題