2015-06-02 87 views
1

我试图发展与春天启动的应用程序,我有以下的HTML春天的SAXParseException

<!doctype html> 
<html ng-app> 
<head> 
<title>Hello AngularJS</title> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script> 
<script src="hello.js"></script> 
</head> 

<body> 
<div ng-controller="Hello"> 
<p>The ID is {{greeting.id}}</p> 
<p>The content is {{greeting.content}}</p> 
</div> 
</body> 
</html> 

我得到这个错误,我不知道为什么,这是相同的代码从https://spring.io/guides/gs/consuming-rest-angularjs/的例子

org.xml.sax.SAXParseException:与元素类型“html”关联的属性名称“ng-app”必须后跟'='字符。

+0

我不认为Spring Boot在这里做了一些特别的事情。检查百里香设置:http://www.thymeleaf.org/doc/usingthymeleaf.html#what-kind-of-templates-can-thymeleaf-process。您也可能会发现这个讨论很有用:https://github.com/spring-projects/spring-boot/issues/1270 – Maks

回答

0

此行似乎有问题我

<html ng-app> 

尝试这一行

<html ng-app=""> 

,因为如果你不希望把你的应用程序angularJS然后声明为空。另外我会建议使用ng-app=""body标签而不是html标签

+0

解决方案是像麦克斯建议的那样添加spring.thymeleaf.mode = LEGACYHTML5,而且这也证明了成为一个解决方案,但它一直在做这件事很烦人 – Victor