Reputation: 8588
Something like:
<div>
<%- if (condition) { %>
<div>This text will be shown if `condition` is true</div>
<%- } %>
</div>
The above example is not working so i'm asking if there is any way to use IF conditions inside the template string, I know that Underscore support it out of the box.
Upvotes: 4
Views: 2285
Reputation: 203359
Use this:
<% if (condition) { %>...<% } %>
(in other words: remove the hyphen)
Upvotes: 11