I have a function called getColor(params) which returns a string to be used for CSS.
I'm trying to call it from another function but instead of the color being returned, I'm being returned the literal function body which is being inserted into my CSS.
Calling Function
coldef = (processedJson) => {
this.customColumns.push(
{
headerName: "Test Set Name", field: "field1", width: 310,
cellStyle: { 'font-size': '12px;' }
});
this.customColumns.push(
{
headerName: "Test Case Name", field: "field2", width: 310,
cellStyle: { 'font-size': '12px;' }
});
for (var i = 0; i < this.columns.length; i++) {
var item = this.columns[i];
this.customColumns.push(
{
headerName: this.columns[i], field: this.columns[i], width: 110,
cellStyle: { 'font-size': '12px;', 'background-color': this.getColor }
});
}
}
My problem is the function is returning function body as text.
this.getColor accepts a parameter called params, but from my understanding this value is inserted by angular and contains my JSON object.
How can I get getColor to return just the string I need?
(arguments)tothis.getColor. How do you normally call a function?this.getColor(params)this.getColoris being called when this code runs, not when it's displayedparamsis not in scope inside the function..