Reputation: 33
I'm using in my HTML Thymeleaf
<h1 class="timer count-title count-number" data-to="${atendida}"
data-speed="1000"></h1>
but data-to="${atendida}"
doesn't work. My controller:
modelAndView.addObject("atendida", size);
How I can use "atendida" in this case?
Upvotes: 0
Views: 353
Reputation: 9155
Welcome to SO.
If you're looking to simply print the value of the object, you can do:
<h1 class="timer count-title count-number" th:text="${atendida}"
data-speed="1000">Some Timer</h1>
If you have a custom attribute value, then you can do
<h1 class="timer count-title count-number" th:attr="data-to=${atendida}"
data-speed="1000">Timer</h1>
If you're looking to do both attributes, you can do:
<h1 class="timer count-title count-number" th:attr="data-to=${atendida},data-speed=${someSpeed}">Timer</h1>
You can read about this in the Thymeleaf docs under "Setting Attribute Values."
Upvotes: 1
Reputation: 97
<h1 class="timer count-title count-number" data-speed="1000" th:attr="data-to=${atendida}"></h1>
Upvotes: 0