'quarkus qute: iteration metadata count, hasNext, ... not working
When making the tutorial
the following error appears
quarkus.qute.TemplateException: Entry "count" not found in the data map in expression {count} in template reports/v1/report_01.json.template on line 5
Configuration: Quarkus 2.6.1.Final, surefire-plugin 3.0.0-M5, compiler-plugin 3.8.1
When removing the "count" from the json-template, it works perfect
I tried also another example (from Sebastian Daschner)
This works perfect with 1.3.1.Final but after updating to 2.6.1.Final the same error occurs.
Can you pls help me. Thomas
Solution 1:[1]
I had the same issue. From the documentation:
However, the keys cannot be used directly. Instead, a prefix is used to avoid possible collisions with variables from the outer scope. By default, the alias of an iterated element suffixed with an underscore is used as a prefix. For example, the hasNext key must be prefixed with it_ inside an {#each} section: {it_hasNext}.
I had to update the {count} to {it_count} or {item_count} for my application after upgrading.
{#each items}
{it_count}. {it.name}
{#if it_hasNext}<br>{/if}
{/each}
Similarly for a for loop:
{#for item in items}
{item_count}. {item.name}
{#if item_hasNext}<br>{/if}
{/each}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kevin.conner |
