how to write right click event for selected row in ng-grid using angularjs
- by user3819122
i am using angularjs to write click event for selected row from ng-grid.but i want to write right click event for selected row from ng-grid in angularjs.below is my sample code for click event for selected row in ng-grid.
Sample.html:
<html>
<body>
<div ng-controller="tableController">
<div class="gridStyle" ng-grid="gridOptions"></div>
</div>
</body>
</html>
Sample.js:
app.controller('tableController', function($scope) {
$scope.myData = [{
name: "Moroni",
age: 50
}, {
name: "Tiancum",
age: 43
}, {
name: "Jacob",
age: 27
}, {
name: "Nephi",
age: 29
}, {
name: "Enos",
age: 34
}];
$scope.gridOptions = {
data: 'myData',
enableRowSelection: true,
columnDefs: [{
field: 'name',
displayName: 'Name',
cellTemplate: '<div ng-click="foo()" ng-bind="row.getProperty(col.field)"></div>'
}, {
field: 'age',
displayName: 'Age',
cellTemplate: '<div ng-click="foo()" ng-bind="row.getProperty(col.field)"></div>'
}
]
};
$scope.foo = function() {
alert('select');
}
});
please suggest me how to do this.