我是backbonejs的新手。我面临以下错误
Uncaught TypeError: undefined is not a function backbone.js:26
这是我的代码
脚本标签内的 index.php
<script>
new App.Router;
Backbone.history.start();
App.contacts = new App.Collections.Contacts;
App.contacts.fetch().then(function () {
new App.Views.App({ collection: App.contacts });
});
</script>
main.js
(function ($) {
window.App = {
Models: {},
Collections: {},
Views: {},
Router: {}
};
window.vent = _.extend({}, Backbone.Events);
})(jQuery);
路由器.js
App.Router = Backbone.Router.extend({
routes: {
'': 'index'
},
index: function () {
console.log('index page');
}
});
集合.js
App.Collections.Contacts = Backbone.Collection.extend({
model: App.Models.Contact,
url : '/contacts'
});
模型.js
App.Models.Appoinment = Backbone.Model.extend({
//validate
});
视图.js
//Global App view
App.Views.App = Backbone.View.extend({
initialize: function () {
console.log(this.collection.toJSON());
}
});
我在这里做错了什么?