Getting familiar with Ag-Grid and caught one problem that I can't pass angular function into menu item cause I assume it gets executed in another scope.
I did assign property for grid as in a tutorial like: [getContextMenuItems]="getContextMenuItems"
And tried to pass angular function to be executed on context menu item click
My angular code looks like this:
public getContextMenuItems(params: GetContextMenuItemsParams) {
const items: Array<MenuItemDef> = [{
name: 'test',
action: () => { this.a() }
}];
return items;
}
public a () {
console.log("test")
}
Expected output: Should console log out "test" on menu click
Actual output: Cannot read property 'a' of undefined