Skip to content
This repository was archived by the owner on Apr 4, 2019. It is now read-only.
This repository was archived by the owner on Apr 4, 2019. It is now read-only.

How to define an “if else” helper #471

Open
@R2D221

Description

@R2D221

Hi, I've recently found this project and I think it's an interesting alternative to Handlebars.

I'm testing some stuff to see how it works, but I can't find the way to set an “if else” helper. Normally in Handlebars this helper is already defined, but its documentation still shows you how it works.

Handlebars.registerHelper('if', function(conditional, options) {
  if(conditional) {
    return options.fn(this);
  } else {
    return options.inverse(this);
  }
});

However, in HTMLBar the API to define helpers is different. You invoke this.yield(); instead. But I can't find a way to tell the yield method to call the else block.

Am I doing something wrong, or is this feature not supported?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions