Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Meteor, Is there a way to use multiple helpers even if one can handle multiple arguments?

In my meteor project, I have multiple helpers. helper1 can handle multiple arguments but he's fine even with a single argument. The problem is I want to chain this handler with the result of another one (helper2), which also takes an argument (the actual user data). So I wrote the following :

{{helper1 helper2 currentUser}}

The problem is that helper1 seems to get two arguments : the result of helper2, and the currentUser, which means helper2 doesn't get the currentHelper argument.

I tried to use parenthesis so that everyone can get its own arguments, like that :

{{helper1 helper2(currentUser)}} or {{helper1 (helper2 currentUser)}}

Or even brackets :

{{helper1 {{helper2 currentUser}}}}

But I get a syntax error with all these workarounds. Is there any working way to do this ?

like image 880
Thomas P. Avatar asked Jan 29 '26 18:01

Thomas P.


1 Answers

I finally found a solution to this problem – using #with:

{{#with firstHelper data}}
  {{secondHelper this}}
{{/with}}
like image 91
dalgard Avatar answered Jan 31 '26 14:01

dalgard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!