I want to implement something like this https://stackoverflow.com/a/18431716/1563880 with this lib
Here is my code:
var expressHandlebars = require('express-handlebars');
var Handlebars = expressHandlebars.create({
....
helpers: {
partial: function(partialName, context, hash) {
return Handlebars.getPartials()
.then(function(partials){
return partials[partialName](context, hash);
});
}
}
})
and use it in this way:
{{{partial partialName this}}} <!-- partialName is a variable -->
but result is
[object Object]
and this object is Promise instance.
How can I get template content?
Final code should be like this:
Please, correct me if I wrong