I have the following columnDefs for my angularjs ui grid :
ctrl.temporaryRegGridOptions.columnDefs = [ {
field: 'firstName',
'displayName': 'First / Company Name',
cellTemplate: '<span ng-click="ctrl.grid.appScope.gotoRequiredState()">{{row.entity.firstName}} </span> '
}, {
field: 'lastName',
'displayName': 'Surname',
width: '150'
} ]
and I have
ctrl.gotoRequiredState = function() {
alert("next State");
}
All I need to do is, on ng-click of a cell I need to call a function.Similar to ClicMe
at http://ui-grid.info/docs/#/tutorial/305_appScope. On the official website this feature is given with $scope
but in my controller, I am using var ctrl = this
; syntax. May be that is the reason even if I have given ng-click="grid.appScope.gotoRequiredState()">
, the gotoRequiredState()
function is not getting called. So I have changed it to ng-click="ctrl.grid.appScope.gotoRequiredState()">
but still no luck. Even after I click firstName
cell, the gotoRequiredState()
function is not getting called. Can any one help me to fix this.