BackboneJS를 배우려고하는데 이것은 내가 겪고있는 오류입니다.TypeError 받기 : this.options는 정의되지 않았습니다.
저는 coffeescript로 코딩하고 있습니다. 이것은 생성 된 JS입니다. 올바르게 진행되고 있다고 생각하면서 이것이 왜 일어나고 있는지 전혀 알 수 없습니다.
(function() {
var AppRouter, MenuItemDetails, app;
MenuItemDetails = Backbone.View.extend({
render: function() {
var markup;
markup = "<div>" + this.options.category + "</div>";
this.$el.html(markup);
return this;
}
});
AppRouter = Backbone.Router.extend({
routes: {
"": "list",
"menu-items/new": "itemForm",
"menu-items/:item": "itemDetails"
},
list: function() {
return $('#app').html('List Screen');
},
itemDetails: function(item) {
var view;
view = new MenuItemDetails({
name: item,
category: 'Entree',
imagepath: 'no-image.jpg'
});
return $('#app').html(view.render().el);
},
itemForm: function() {
return $('#app').html("New item form");
}
});
app = new AppRouter();
Backbone.history.start();
}).call(this);
/*
//@ sourceMappingURL=app.map
*/
어디로 잘못 가고 있습니까?
이 질문에 비슷한이인가/답변? http://stackoverflow.com/questions/19325323/backbone-1-1-0-views-reading-options 기본적으로 this.options는 더 이상 기본적으로 사용할 수 없습니다. –
정말 고마워요! 날 올바른 방향으로 보냈어! – user3187254