I found this helper online that checks whether a variable is equal to a certain string. I tried to add this helper to my index.hbs file, but I get the following error: Missing helper: "if_eq"
Can someone tell me how I can fix this? I did what they asked me to do in in the official Handlebars docs, so I don't understand. I use NodeJS/Express, but without require('handlebars')
or require('express-handlebars')
, because that's how express-generator generated it for me.
index.hbs:
<script>
Handlebars.registerHelper('if_eq', function(a, b, opts) {
if(a == b)
return opts.fn(this);
else
return opts.inverse(this);
});
</script>
[do something]
[do something else]
via Zarif
No comments:
Post a Comment