Reputation: 5281
I have this underscore template that I want to add ids to but for some reason I am not getting the result that I want
script(type="text/template" id="facts")
div.fact.col-md-12(id="fact<%= count %>")
div.col-md-8
div.col-md-2
| Fact <%= count %>
div.col-md-10
gives me
<div id="facts-container" class="col-md-12">
<div id="fact<%= count %>" class="fact col-md-12">
<div class="col-md-8">
<div class="col-md-2">
Fact 1
</div>
I want to be able to add an id with a count attached to the id, how should I go about this ?
Upvotes: 0
Views: 175
Reputation: 13226
You can use !=
to avoid escaping the output text.
http://jade-lang.com/reference/code/ (Unescaped Buffered Code)
Jade
div.fact.col-md-12(id!="fact#<%= count %>")
div.col-md-8
div.col-md-2
| Fact <%= count %>
div.col-md-10
Output HTML
<div id="fact#<%= count %>" class="fact col-md-12">
<div class="col-md-8">
<div class="col-md-2">Fact <%= count %></div>
<div class="col-md-10"></div>
</div>
</div>
Upvotes: 2