Call helper from component

Hi, I want call from component to helper, this works fine when I use function helper, but I need to use class helper

export default class ExampleHelper extends Helper {
  compute() {
    return  1 + 1;
  }
}

But I get undefined results because compute is asynchronous Is there a solution to this problem?

I think we need a little more context, especially about this part. What do you mean by “because compute is asynchronous”? Are you using an async compute function?

To invoke a helper from Javascript, you can use the invokeHelper utility.

It was added in Ember v3.23.0.

2 Likes

Thanks, it helped me