0

So i have created a custom handle bar that check equality like this

HandlerBars.registerHelper('ifEquals', (arg1, arg2, options) => {
      if (arg1 == arg2) {
        return options?.fn(this);
      }
      return options?.inverse(this);
    });

and i am basically using it in the html like this {{#ifEquals property "string"}}

Now in this block i have a text to render and another #if handle bar.

The problem is that it renders the text before the if handle bar but it doesnt call the if handle bar even if it should return a property ,it instead goes to the {{else}} in that if handlebar

AverageSoul
  • 85
  • 2
  • 6

1 Answers1

0

i have solved the issue by using another handlebar written like this

HandlerBars.registerHelper('equals', (arg1, arg2, options) => {
      return arg1==arg2;
    });

and in the main handlebar (#ifEquals) i changed that to {{#if (equals field "string")}} and the rest left the same and it worked.

AverageSoul
  • 85
  • 2
  • 6