Your logic is good, just make some changes to the template
<template name="myTemplate">
{{testHelper "value1" "value2"}}
</template>
Bare in mind that the testHelper function is only defined in the myTemplate template.
If you want to register testHelper globally you'll need to do something like this
Handlebars.registerHelper('testHelper', function(foo, bar){
console.log(foo);
console.log(bar);
});
Have fun
Addition to
<template name="myTemplate">
{{testHelper "value1" "value2"}}
</template>
Instead of passing a value as a parameter pass the function as parameter Here is the code for that
<template name="myTemplate">
{{ testHelper1 (testHelper2 "value2") }}
</template>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With