0
在這個plunk我有一個ngTable顯示兩行。我想在雙擊某行時運行一個函數。我試過ng-dblclick
但它不起作用。有任何想法嗎?在ngTable中捕獲雙擊
HTML
<div ng-controller="myCtl" ng-app="app">
<table ng-table="tableParams" class="table table-bordered table-hover">
<tbody>
<tr ng-repeat="u in data" ng-dblclick="alert('double click')">
<td title="'User ID'" style="width:150px">{{ u.uid }}</td>
<td title="'Name'" style="width:150px">{{ u.nm }}</td>
<td title="'Group'" style="width:200px">{{ u.ugr }}</td>
</tr>
</tbody>
</table>
的Javascript
var app = angular.module('app', ['ngTable']);
app.controller('myCtl', function($scope,$timeout,NgTableParams) {
$timeout(function() {
$scope.data = [
{ uid: 'User 1', nm: 'Name 1', ugr: 'Group 1'},
{ uid: 'User 2', nm: 'Name 2', ugr: 'Group 2'}
];
$scope.tableParams = new NgTableParams({dataset: $scope.data});
}, 1000);
});