【问题标题】:Angular directive cause org.thymeleaf.exceptions.TemplateInputExceptionAngular 指令导致 org.thymeleaf.exceptions.TemplateInputException
【发布时间】:2016-04-28 13:44:11
【问题描述】:

我使用spring 4.2.5,thymeleaf 2.1.4。问题是当我在Html中使用Angular's directive时,会导致异常。

org.thymeleaf.exceptions.TemplateInputException

HTML代码如下

<input type="password" name="password" placeholder="Password" 
ng-minlength="6" ensure-same ng-required="true" required/>

问题是ng-minlength,ensure-samerequired。如何解决?

【问题讨论】:

    标签: angularjs spring thymeleaf


    【解决方案1】:

    使用 data-ng-minlength="6" 和 required="required"。

    您需要在角度指令之前添加“数据-”。默认情况下,angular 会查找带有和不带有数据前缀的数据,并且数据前缀是自定义属性的 html 标准。

    顺便说一句,如果不是绝对必要的话,我强烈建议您不要混合使用 angular 和 tymeleaf。让你的静态资产由 spring (webserver/cdn) 以外的东西提供服务要容易得多,让 spring 只提供一个 json rest api 供 angular 访问。

    【讨论】:

      猜你喜欢
      • 2016-11-19
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 2012-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-18
      相关资源
      最近更新 更多