Open robsilva opened 8 years ago
When I call the helper like this {{foo}} it works, but with inbuilt helpers like this {{#each foo}} {{/each}} it doesn't work. Are you facing the same issue? http://stackoverflow.com/questions/37178436/express-handlebars-built-in-helpers-not-working
Same problem here
Same here, also if I register any custom helpers in exhbs.handlebars instance then also it is not available in applicaiton helper. If we can not set the custom helper in global handlebar's instance then this module is of no use. I am currrently using https://github.com/barc/express-hbs in my project but because of slow rendering I was trying some alternative library.
Bah, same problems here...
Can only render helper functionality from the render method. Is there anyone with an answer to this?
app.engine('handlebars', exphbs({
defaultLayout: 'main',
helpers: {
yourFirstGlobalHelper: function (foo) { return foo },
yourSecondGlobalHelper : function (bar) { return bar}
}
}));
app.set('view engine', 'handlebars');
And in your templates, simply call your global helpers this way:
<div>{{yourFirstGlobalHelper foo }}</div>
I've replicated this too.
So for me when I have a an each helper:
{{#each someArray}} {{>partial itemInArray}} {{/each}}
Then in the partial.hbs, custom helpers that have been added to global Express are not available.
This also seems to be true for parent context items when in each ( ../parentItem) and there is a bug for this too: #196
I would like to have my handlebar helpers available to all my views, but for some reason this doesn't work:
When I try to output that in my view I get nothing.
But if I set the function inside my render() method, it works:
Has anyone run into this issue?
Thank you in advance.