I'm attempting to construct a query to retrieve assets based on a selected JCR node type. I'm attempting to compare the nodeType variable within the following condition.
I have added condition:
{{#if '{{nodeType}}' == 'dam:Asset'}}
From the above observation, it is noted that I am encountering this exception:
Caused by: com.github.jknack.handlebars.HandlebarsException: inline@107adee3:5:21: found: '=', expected: '}}' {{#if '{{nodeType}}' == 'dam:Asset'}}
I tried with {{#if '{{nodeType}}' = 'dam:Asset'}}, still the same issue.
Please let me know the appropriate syntax.
_ Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
The problem is your Handlebars syntax is incorrect. In Handlebars, you don't need to use {{
and }}
inside an {{#if}}
block, as you're already in the Handlebars context. I think below will be the correct syntax
{{#if (eq type 'dam:Asset')}}
But please check the documentation to fix it: https://handlebarsjs.com/guide/builtin-helpers.html
Adding an additional resource where handle this scenario: https://stackoverflow.com/questions/34252817/handlebarsjs-check-if-a-string-is-equal-to-a-value
Hope this helps
Hi,
The problem is your Handlebars syntax is incorrect. In Handlebars, you don't need to use {{
and }}
inside an {{#if}}
block, as you're already in the Handlebars context. I think below will be the correct syntax
{{#if (eq type 'dam:Asset')}}
But please check the documentation to fix it: https://handlebarsjs.com/guide/builtin-helpers.html
Adding an additional resource where handle this scenario: https://stackoverflow.com/questions/34252817/handlebarsjs-check-if-a-string-is-equal-to-a-value
Hope this helps
Views
Likes
Replies