Replies: 1 comment 1 reply
-
|
I also tried adding a variable which takes the item and put it in 'myresponse' but also that did not work <template>
<template type="repeat" repeat="{{ currentItem.responses }}"> <!-- 1 -->
+ <h-var name="response" .value="{{ item }}"></h-var>
- {{ item.text }}
+ {{ response.text }}
<!-- ⇧ ------ item is the response -->
<test-scoring-buttons .item="{{ currentItem }}">
<template>
<template type="repeat" repeat="{{ scores }}"> <!-- 2 -->
<!-- I need this response in the the name, but I can not access item because it represents the score now -->
- <input type="radio" name="{{ __item__.identifier }}" ?checked="{{item == score}}" />
+ <input type="radio" name="{{ response.identifier }}" ?checked="{{item == score}}" />
<span>{{item}}</span>
</template>
</template>
</test-scoring-buttons>
</template>
</template>Would a it help if i setup a repo to explain this problem, or does anyone knows if this is solvable with the explanation above. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I need the item variable from the 1st loop, but is is shadowed by the 2nd loop.
Can I name the 'item' variable. I can't find it in the documentation.
ChatGPT suggests the as attribute, but that does not seem to work.
... <template type="repeat" repeat="{{ scores }}" as="score"> <!-- Now 'score' is used inside this loop, and 'item' still refers to the response from the outer loop --> <input type="radio" name="{{ item.identifier }}" ?checked="{{item == score}}" /> <span>{{ score }}</span> </template> ...Is there a way to solve this?
Beta Was this translation helpful? Give feedback.
All reactions