While working on my context menu, I encountered an issue trying to call a function.
getContextMenuItems(params) {
console.log(params.node.data)
var result = [
{
name: "Delete",
action : function () {
this.deletePriceFactor(params.node.data);
}
,
cssClasses: ["redFont", "bold"]
},
{
name: "Audit"
}
]
return result;
}
deletePriceFactor = (rowdata) =>{
this.priceFactorService.deleteEntry(rowdata.exchangeCode, rowdata.productCode, rowdata.secType).subscribe(pricefactors => {
});
}
Despite my efforts, I kept encountering the following error message: ERROR TypeError: this.deletePriceFactor is not a function at Object.action (price-factor.component.ts:162)
I experimented with arrow functions like this:
action : () => {
this.deletePriceFactor(params.node.data);
}
However, this led to yet another error: core.js:1673 ERROR TypeError: Cannot read property 'deletePriceFactor' of undefined