sndu
sndu

Reputation: 1033

Thymeleaf: Dynamic carousel does not link to the relevant slider while using the index in data-slide-to attribute?

I am generating a dynamic carousel using Thymeleaf th:each loop as below.

The indicators are generated accurately but the value I have assigned to data-slide-to attribute is not working. Therefore I can't link the sliders with indicators.

<ol class="carousel-indicators">
    <th:block th:each="deal, rowStat : ${sliderDeals}">
        <li data-target="#myCarousel" data-slide-to="${rowStat.index}" class=""></li>
    </th:block>
</ol>

When the indicators are clicked it does not slides to any of the sliding images. But the indicators are generated with relevant to the number of sliding images.

Can anyone figure out what is the issue here?

Upvotes: 2

Views: 1142

Answers (1)

MohamedSanaulla
MohamedSanaulla

Reputation: 6242

In Thymeleaf any custom attributes need to be generated as: th:attr="data-slide-to=${rowStat.index}"

Upvotes: 3

Related Questions