Setting an exported function (that works with params) as filter for material datepicker

Viewed 28

I am trying to set an exported function as const in a material datepicker filter with params, but when I set params, in my component, the function is launched getting the result of the function (boolean) and not the definition of the function to set my datepicker filter. Can someone help me with a solution or alternative? Thanks anyway.

Exported function:

export const daysFunction = (d: Date, days: any): boolean => {
  if (days) {
    return true;
  } else {
    return false;
  }
};

In my component:

daysFunction = daysFunction(null, days); // this launch my function
1 Answers

You can define the method in the component class as:

daysFunction = () => daysFunction(null, days);       // if days is global or local
daysFunction = () => daysFunction(null, this.days);  // if days is a class member
Related