Marionette: Uncaught TypeError: * is not a constructor

Marionette: Uncaught TypeError: * is not a constructor

我正在读 Marionette gentle introduction 本书。我正在关注 显示模型 章节并具有以下代码:

ContactManager.ContactView = Marionette.ItemView.extend({
    template: "#contact-template"
});

ContactManager.on("start", function(){
    var alice = new ContactManager.Contact({
        firstName: "Alice",
        lastName: "Arten",
        phoneNumber: "555-0184"
    });

    var aliceView = new ContactManager.ContactView({
        model: alice
    });

    ContactManager.regions.main.show(aliceView);
});

ContactManager.start();

和 html 页面中的以下元素:

<script type="text/template" id="contact-template">
    <p><%- firstName %> <%- lastName %></p>
</script>

我收到错误:Uncaught TypeError: ContactManager.Contact is not a constructor。我究竟做错了什么?

看来您需要先声明您的模型,然后再创建它的实例

ContactManager.ContactView = Marionette.ItemView.extend({
    template: "#contact-template"
});

ContactManager.Contact = Backbone.Model.extend({});