Griffin Stuart Smith
Griffin Stuart Smith

Reputation: 29

How to use equality in handlebars build-in #if helper

In handlebars how can I say for example:

{{#if view_type == "medium"}}
    // Do something
{{/if}}

Not simply :

{{#if view_type}}
    // Do something
{{/if}}

Im am using it in NodeJs

Im looking for solution without registerHelper()

Upvotes: 1

Views: 254

Answers (1)

DevAlien
DevAlien

Reputation: 2476

There's no solution without a new helper. What I would suggest you is to switch from handlebars to Swig, which, the syntax, is pretty similar.

http://paularmstrong.github.io/swig/docs/

It is easily implementable.

If you are trying to do an IF I guess you are at the beginning of your project so it could be an option.

Upvotes: 1

Related Questions