Closed haswent closed 5 years ago
Hello, have you found a solution for this? I have the same problem here.
Yeah - So the helpers don't get shared within the templates on the client side, so i've had to manually register the helpers on the client side for now (Will look at using a build time script to do this in the future)
Example:
<script>
Handlebars.registerHelper('if_eq', function (a, b, opts) {
if (a == b) return opts.fn(this);
else return opts.inverse(this);
});
Handlebars.registerHelper('ToLowerCase', function (str) {
return str.toLowerCase();
});
</script>
I have a weird issue where my text/x-handlebars-template cannot see helpers but the main .hbs file can.
Creating hbs like this passing in helpers:
Example of a helper being passed in
I'm using this within the main .hbs file and it works correctlly however i'm also updating some data using and API call and using the below tag to store the hbs template to call later
However i'm getting an error within my template that:
But i'm using the if_eq helper in lots of places within my template and it works fine, not sure if a particular library has been updated in node but it has stopped working when it used to work previously