This template has a spelling error in the first if
statement, and it returns nothing. When I place a debugger
statement in this template, it gets to the first if
statement, then dies. Examining __p shows me valid javascript, so I'm confused on why the whole templating function is returning nothing.
If identifer
is undefined (it's not passed to the template function; only the correct identifier
placeholder is), shouldn't it log an error to the console, stating that the variable I am trying to compare is undefined?
<h3>This is the <%= identifier %> for the thing.</h3>
<% if (identifer === "something") { // spelling error in this line. %>
<p>It is something.</p>
<% } else if (identifier === "something else") { %>
<p>It is something else.</p>
<% } else { %>
<p>The <%= identifier %> is something completely different.</p>
<% } %>
<div>
<p>Some other HTML follows</p>
</div>
The template just dies, with no indication of what's wrong, and this seems weird to me. Any ideas why Underscore templates work this way?
Change this line in the template from <% if (identifer === "something") { %> to <% if (identifier === "something") { %>