我也想知道Thymeleaf和AngularJS是否可以一起使用。
哪一个会成为第一个?
如果你有Thymeleaf选择..。想让AngularJS提供一个commandsBySection数据列表,如下所示.
<select id="tl1_com_sel" th:field="*{command}" ng-model="tl1Data.command" >
<option selected="selected" value=""> select an option </option>
<option th:each="command: ${<b>commandsBySection}"
th:value="${command}"
th:text="${command}">COMMAND</option>
</select>您将得到${commandsBySection}}.
我对这些技术很陌生..。是否有AngularJS在Thymeleaf页面中呈现select的示例?
发布于 2016-03-04 15:51:40
它们可以一起使用,需要记住的关键一点是,Thymeleaf的输出是在将结果页面传输到客户端浏览器之前生成的服务器端。一旦在浏览器上呈现,AngularJS就会进入客户端。
我从来没有这样做过,我可以想象使用Thymeleaf开发所有AngularJS页面会让人头疼,因为:
但是,如果您只使用Thymeleaf在服务器上呈现HTML片段,并让您的AngularJS应用程序动态显示这些代码,那么它可以很好地工作。
因此,为了回答您的问题,首先在服务器上呈现Thymeleaf模板,然后在客户机上由浏览器呈现AngularJS页面。将它们一起使用以使Thymeleaf生成一个AngularJS页面可能不是一个好主意,但是在一个项目中将它们一起使用就可以了。
https://stackoverflow.com/questions/35257344
复制相似问题