问题
when using underscore template i want to interpolate a value in anchor's href attribute like
a(href= "<%= id %>", class='products') //underscore template in jade
but the out put is
<a href="<% id %>" class="products">
so how to escape the < and > sign , and interpolate the value correctly?
回答1:
Use != instead of = to unescape.
In your case:
a.products(href!="<%= id %>")
来源:https://stackoverflow.com/questions/12351148/my-underscore-template-is-not-working-in-jade