Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring MVC does not render html with angularjs directive

the angularjs feature called directive cause to problems in spring mvc. If I use thymeleaf to render a html with elements such

<div ui-view autoscroll="false"></div>

i got a error like

org.xml.sax.SAXParseException: Attribute name "ui-view" associated with an element type "div" must be followed by the ' = ' character.

is there an elegant workaround or should I use something else than thymeleaf?

Edit:

Many thanks for your answers, they helped me a lot.

Either you code xml or you use some workaround. open your application.properties and add following

spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
spring.thymeleaf.cache=false
like image 260
Rudolf Schmidt Avatar asked Jan 11 '23 04:01

Rudolf Schmidt


1 Answers

Just put the below code. basically what it is saying is that every attribute in HTML should have a value. When the browser renders it, it will anyway look like below.

<div ui-view="" autoscroll="false"></div>

Update: You can also use directive in a class or as an element.

like image 175
TheRodeo Avatar answered Jan 17 '23 17:01

TheRodeo