这里NoTemplateError Backbone.Marrionette但节目模板是我的错误:错误味精
Uncaught NoTemplateError: Could not find template: '<!-- HTML Template -->
<div id="start_div">
<h2>Choose your path to ... // the rest of the template
它告诉我,没有模板,但随后其输出它说,它无法找到模板。
这里是我的代码:
require(["jquery", "marionette", "views/StartView" ],
function($, marionette, StartView) {
var SCApp = new marionette.Application();
SCApp.addRegions({
mainRegion: "#center_court"
});
var startView = new StartView();
SCApp.mainRegion.show(startView);
SCApp.start();
}
这里是StartView.js
define(["jquery", "marionette", "text!templates/startDiv.html"],
function($, marionette, template){
var StartView = marionette.ItemView.extend({
//template: "#start_div"
template: template
});
// Returns the View class
return StartView;
});
有人能看到我在做什么错?在require方法中需要模板吗?
任何建议,非常感谢。
安德鲁
(替他人)在我的情况下,错误发生了什么,因为被加载一个空的模板。当我在模板中添加HTML注释或空跨度时,错误消失了。 – Johannes