External Scope attribute not working in row template
The externalScopes attribute doesn't seem to be allowing me to access the external scope function from within a custom row template. Perhaps I'm doing something wrong still?
Controller function -
$scope.theClick = function()
{
console.log("clicked");
}
HTML -
<div style="width:1000px; height:500px" ui-grid-selection ui-grid="gridOptions" externalScopes="theClick()"></div>
Row Template -
function rowTemplate() {
return '<div context-menu ng-click="theClick()" ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ui-grid-cell data-target="myMenu"></div>';
}
see 202 External Scopes tutorial. You must use getExternalScopes() in your templates to access your external scope variable. You can't put the function on the attribute. You can put the function name. But I would recommend created a container property to holde these functions @scope.viewModel = {theClick:function(){}} externalScopes="viewModel"
How to use getExternalScopes() on subgrids expandabled rows from templates
How to add modal dialog on click of a button in subgrid using external scopes?
Got the solution. Check this link for answer https://github.com/angular-ui/ng-grid/issues/1782