2013-04-26 54 views
3

我得到一個SyntaxError:使用下劃線模板在Backbone應用程序中呈現html時意外的EOF輸出。這裏是我的模板: -什麼導致SyntaxError:下劃線模板中出現意外的EOF錯誤?

<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> 

它是專門示數在這一部分: -

id="<%= _.escape(menuItem.id)" 

id屬性是一個數字,這裏是MenuItem對象: -

dataPath: "" 
helpType: "default" 
id: 0 
moduleName: "TestModule" 
modulePath: "interaction/test/testmodule" 
title: "Test Module Interaction" 

我試圖讓id成爲一個字符串,或者使它成爲下劃線模板代碼中的title屬性,以查看我是否可以獲得任何形狀或形式的測試用例,但是我很困惑。我有一個類似的模板,幾乎完成同樣的事情,沒有任何錯誤。

任何想法是什麼愚蠢我參與造成這種情況? :-)

回答

5

貌似沒有用%>

+0

關閉<%=哇。捂臉。非常感謝@neo :-) – SamBrick 2013-04-26 10:33:55

相關問題