Reputation: 8073
I'd like to use Jade to set the class of list item. For example, I'd like to pass a string 'foo' to the list class from a JSON object, {'class': 'foo'}
:
<li class='foo'> blah </>
Using Jade, I'm trying to do something like this to set the class to foo:
li = #class
How can I template thus correctly in Jade?
Upvotes: 0
Views: 131
Reputation: 1868
According to this answer: variable in class name jade
You should be able to do this:
li(class="#{ class }") blah
Upvotes: 2