How to pass thymeleaf DTO value to Javascript Function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to pass thymeleaf DTO value to Javascript Function

Nayan
Hi,

I have this below value coming from a DTO:
th:include="components/inputText :: inputText('city','state.city',${objectMainDataDTO.state.city})"
                                                        th:with="isRendered='true',maxLength='10',isDisabled='true',layoutClass='col-lg-4 col-md-4 col-sm-12'" />

I want to pass this ${objectMainDataDTO.state.city} value to Javascript function:

 var pt = new Point({
 city:beijing, --> as of now its hardcoded, but I need to pass city value dynamically which is coming from DTO
 area:zang
    });

Can any one help me on this topic?
Reply | Threaded
Open this post in threaded view
|

Re: How to pass thymeleaf DTO value to Javascript Function

Metroids
Not really sure exactly the problem, but it should be doable with javascript inlining.

http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#script-inlining-javascript-and-dart