110
rated 0 times
[
117]
[
7]
/ answers: 1 / hits: 25543
/ 11 Years ago, fri, april 26, 2013, 12:00:00
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? :-)
More From » html