Passing a parameter to a helper using the template

I wanna know if it’s possible to do something like:

{{> templateName helper: (param1, param2)}}

Template.templateName.helpers({
helper: function (var1, var2) {
alert(var + " " + var2)
}
})

I usually use

{{> actionInput showSend=true}}

Then in actionInput you access showSend with this.showSend

1 Like

It’s more similar to a lisp-like language than a function call, ie. you want the brackets on the outside and a space between parameters:

 {{> templateName (helper param1 param2) }} 

This would use the returned result from the helper as the whole data context for the template being rendered, It’s usually preferred to pass it with a name like @drollins suggests:

 {{> templateName someVar=(helper param1 param2) }} 
1 Like

Thank you so much, that was exactly what i wanted. :grinning: