How to add multiple CSS classes to HTML node in Closure template (soy)?

613 Views Asked by At

In a template I need to assign more than one CSS class to a div.

However, when I try something like the following, the Closure compiler seems to wrap only the first class in quotation marks, resulting in the browser ignoring the rest.

<div class={foreach $cssClass in $cssClasses}{$cssClass} {/foreach}>...</div>

DOM result

I tried wrapping the whole thing in quotation marks (with and without {literal})... didn't do the trick.

1

There are 1 best solutions below

4
On BEST ANSWER

Wrap class in quotations

<div class="{foreach $cssClass in $cssClasses}{$cssClass} {/foreach}">...</div>