I have a component that receives a model A with a belongsTo relationship to model B. There are properties of B that I would like to render in A’s component, after doing some manipulation on them. Let’s say B has some property X that I need to manipulate with some function F before rendering it. One option would be to make F a template helper and just write in my template {{F A.B.X}} but say I have good reasons to instead want to apply F in the component’s js file. I tried doing something like this:
export default class MyComponent extends Component {
get y() {
return f(this.args.a.b.x)
}
}
and then:
{{this.y}}
However that doesn’t work because this.args.a.b is a “proxy” object, which I guess would need to be awaited. However, a getter function cannot be asynchronous.
What approach do you suggest I pursue here?
And if you’re wondering why I’d rather not use helpers, it’s because I have lots of post-processing that I need to do on B’s properties, and it feels tedious to create a helper for each.
1 post - 1 participant