angularjshtmlangular-ui-gridcelltemplate

how to pass two parameters into grid.appScope in ui-grid


I am trying to pass 2 parameters into the ui-grid cell template.

e.g: ng-click="grid.appScope.copyOperation(row.entity, copyOperation).

copyOperation would obviously be a string.

Reason: Reduce redundancy in code by maintaining a single method for all the grid operations(delete, copy and edit) with if else conditions.

On the controller side, the function would be like

$scope.copyOperation= function(row, operation) {
//Do necessary steps by operation
};

But, unfortunately I get undefined in operation (No Errors). So, how do I pass a string in this case? Any alternate suggestions will also be helpful. Thank you!


Solution

  • Sorry about that petty question.

    ng-click="grid.appScope.copyOperation(row, \'copy\')
    

    will let operation arg be set to copy.

    Thanks!