Andrew Mairose Andrew Mairose - 1 year ago 154
AngularJS Question

Thymeleaf parsing error when using "&&" in AngularJS expression

I have an AngularJS

attribute in my Thymeleaf template that looks something like this:

<span ng-show="aIsValid && bIsValid"></span>

When Thymeleaf tries to process this template, I get the following exception:

org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.

Does Thymeleaf just not play nicely with
logic in Angular attributes? Or is there a workaround for this other than slapping a method on my
that will simply
return $scope.aIsValid && $scope.bIsValid

Answer Source

Replace && with &amp;&amp; because & must be escaped in XML.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download