Thymeleaf: How to load a thymeleaf processed fragment in a local variable using th:with?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Thymeleaf: How to load a thymeleaf processed fragment in a local variable using th:with?

ravi.g.nihalani@gmail.com
<div th:with="local_var = ~{fragment_file :: fragment_name}"></div>
 
The above code get's me the html markup from the fragment but fail's to evaluate the thymeleaf data in it (for e.g. ${data} used in the fragment is returned without evaluating it)

<div th:replace="fragment_file :: fragment_name"></div>
On the other hand, if I use th:replace like above for the same fragment, it processes the fragment just fine