2

I have a list of objects coming in angular scope:

<datalist id="someList">
    <option ng-repeat="element in elements" value="{{element.name}}" />
</datalist>

I have to bind attributes of element to thymleaf object. How can I do that (both of the below ways are binding ,,,,,,,,,, to the variable):

<option ng-repeat="element in elements" value="{{element.name}}" >
  <input type="hidden" th:field="*{elementId}" value="{{element.id}}" />
  <input type="hidden" th:field="*{elementsomethingElse}" th:value="|{{element.somethingElse}}|" />
</option>
Anil Bhaskar
  • 3,718
  • 4
  • 33
  • 51
  • 4
    You shouldn't even need thymeleaf if you use angular. A thymeleaf template is used to generated HTML at server-side. You're using Angular, which has its own templates, used to generate HTML at client-side. In the end, what matters is that the browser has the needed HTML. Why do you think you need thymeleaf? What are you trying to achieve? – JB Nizet Nov 20 '17 at 12:55
  • Most of the views are thymleaf templates in my code, except browser side rendering of data on view. – Anil Bhaskar Nov 20 '17 at 12:58
  • 2
    You're making your own life complicated. But anyway, this doesn't change anything. thymeleaf is a server-side template engine to generate HTML. Once a thymeleaf view has executed, it has generated pure HTML code, that has nothing to do with thymeleaf. So, generate the same HTML at client-side using angular, and you'll have the same result. – JB Nizet Nov 20 '17 at 13:26
  • Related: [What is the difference between client-side and server-side programming](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – g00glen00b Nov 20 '17 at 13:37

0 Answers0