1 year ago

#237479

test-img

Dhanesh Saini

Handlebars custom registerHelper error : not returning anything

handlebars.registerHelper('isVideo', (val, options) => {
    if (val == 'video') {
        return options.fn(this)
    }
    else {
        return options.inverse(this);
    }
})
{{#each content}}
          {{#isVideo this.type}}
           <span>This is showing</span>
           <span>This is a not {{this.video}}</span>
          {{else}}
           <span>This is showing</span>
           <span>This is a not {{this.image}}</span>
          {{/isVideo}}
{{/each}}

Why span {{this.video}} and {{this.image}} not return anything. what is error?

express

handlebars.js

express-handlebars

handlebarshelper

0 Answers

Your Answer

Accepted video resources