Closed sudoStatus200 closed 5 years ago
ok fixed it. it was a small mistake. correct ; ` transporter.use('compile', hbs({ viewEngine: { extName: ".handlebars", partialsDir: path.resolve(__dirname, "views"), defaultLayout: false, helpers: { if_eql: function(a, b, opts) { if (a == b) { return opts.fn(this) } else { return opts.inverse(this) } } }, }, viewPath: path.resolve(__dirname, "views"), extName: ".handlebars" }));
`
I want to create a helper function for equality check. I tried like this:
transporter.use('compile', hbs({ viewEngine: { extName: ".handlebars", partialsDir: path.resolve(__dirname, "views"), defaultLayout: false // <----- added this }, viewPath: path.resolve(__dirname, "views"), extName: ".handlebars", helpers: { if_eql: function(a, b, opts) { if (a == b) { return true } else { return opts.inverse(this) } } } }));
and `{{#if_eql this 'prime'}} ....{{/if_eql}}`
but it gives error : message: 'Missing helper: "if_eql"',