Reputation: 771
I am getting a SyntaxError: Unexpected EOF output when using an underscore template to render html in a Backbone application. Here is my template:-
<script type="text/template" id="shellmenu-template">
<div>
<p>menu template html will go here....</p>
<div class="menuButtonsContainer">
<% _.each(menu, function(menuItem){ %>
<button class="menuButton" id="<%= _.escape(menuItem.id)"><%= _.escape(menuItem.title) %></button>
<% }); %>
</div>
</div>
</script>
It is specifically erroring on this part:-
id="<%= _.escape(menuItem.id)"
The id attribute is a number, here is the menuItem object:-
dataPath: ""
helpType: "default"
id: 0
moduleName: "TestModule"
modulePath: "interaction/test/testmodule"
title: "Test Module Interaction"
I have tried making the id a string or making it the title attribute in the underscore template code just to see if I can get a test case working in any shape or form but I am stumped so far. I have a similar template doing pretty much the same thing with no errors.
Any ideas what silliness I am engaging in to cause this? :-)
Upvotes: 3
Views: 26012