Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Logical OR/ '||' operator in nodejs Handlebars ? #259

Open
JigneshPatel04 opened this issue Aug 1, 2019 · 2 comments
Open

How to use Logical OR/ '||' operator in nodejs Handlebars ? #259

JigneshPatel04 opened this issue Aug 1, 2019 · 2 comments

Comments

@JigneshPatel04
Copy link

Hello,

I am using nodejs handlebars .

I used input field and i have applied || condition in my code . but error occurred on it. Like as below

Error: Parse error on line 9:
...alue="{{#if editing || hasError }} {{pro
-----------------------^
Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'EQUALS', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'CLOSE_BLOCK_PARAMS'
at Parser.parseError (G:\Learning\Course\Node\Maximilian-Node_Complete_

Any one idea ?

@UziTech
Copy link

UziTech commented Aug 1, 2019

https://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional

You will have to create a block helper for that. handlebars.js doesn't have a built in way to do that.

@UziTech
Copy link

UziTech commented Aug 1, 2019

handlebars-helpers is a package that has a bunch of useful block helpers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants