Reputation: 2066
Is it possible to have Html tag inside a th:text ?
for instance:
<h2 th:text="'LOCATION INFO Device <strong>' + ${deviceKey} + ' </strong> at ' + ${deviceEventTime} ">
Upvotes: 6
Views: 6232
Reputation: 1
It's possible with this syntax [(${brand})]
:
<h3 th:object="${brand}" class="text-center text-black mt-5">
All Products By Brand
<span>
<b class="text-danger">[(${brand})]</b>
</span>
The object in this case is a String, but you can use ${object.something}
.
Upvotes: 0
Reputation: 20487
Yes, what you have works if you use th:utext
instead of th:text
.
<h2 th:utext="'LOCATION INFO Device <strong>' + ${deviceKey} + ' </strong> at ' + ${deviceEventTime}" />
I would personally format it like this, however:
<h2>
LOCATION INFO Device
<strong th:text="${deviceKey}" />
at
<span th:text="${deviceEventTime}">
</h2>
(Which may or may not be possible, depending on your actual requirements.)
Upvotes: 8