Cannot add HxCarouselItem by a loop #957
-
Is it possible to create a carousel dynamically? The following loop is always executed before the creation of HxCarouselItem items. So i is always == managerQuestions.Count - 1 and the @if (i % 2 == 0) doesn't work.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I don't think this is about the |
Beta Was this translation helpful? Give feedback.
-
Thank you that works. |
Beta Was this translation helpful? Give feedback.
I don't think this is about the
HxCarousel[Item]
. You can't use the loop variablei
directly in lambda expressions or nestedRenderFragments
. Try addingvar index = i;
as the first line inside thefor
loop, and then useindex
variable instead ofi
everywhere (for example,if (index % 2 == 0)
).