AngularJS 和 Thymeleaf 之间的冲突

Conflict between AngularJS and Thymeleaf

我是 angularJS 和 Thymeleaf 的新手,遇到了一些奇怪的冲突。

这是我下面的

   <input type="text" th:field="*{unit}" value="{{unit.unitID}}" class="unit_value"/>

每当模板被解析并显示在浏览器中时,值就会设置为空,如下所示

<input class="unit_value" type="text" value="" id="unit" name="unit" />

值中不再有 angularJS 表达式。

我知道这个表达式是百里香的同义词,我真的不知道如何解决这个问题。

找遍了都找不到解决方法

我找到的解决方案是从字面上自己绑定标签,并使 thymeleaf 不再绑定它,它只是放在预期生成的 html 中,thymeleaf 将生成

  <input type="text" name="unit" value="{{unit.unitID}}" class="unit_value"/>

一切正常。