0

I would like to ask if it is possible to have nested attributes in HTML tag which can reuse result of previous one. For example

<p custom:one="some text to process" custom:two="process result of custom:one">

where custom:one can be used standalone but custom:two have to be used with custom:one. The final result will be produced by custom:two

ketrab321
  • 541
  • 2
  • 12
  • 22

1 Answers1

0

if I got you right, you can do it with local variables

You need to specify th:with to declare a variable.

Note that the declared variable is available within the element.

<div th:with="newValue = 'Hello ' + ${val}">
  <span th:text="${val}">One</span>
  <span th:text="${newValue}>Two</span>
</div>

Let me know if that's what you're looking for.

Viktor Born
  • 186
  • 1
  • 5