私はbackbone.jsを学んでいます。以下の例を書いたのですが、うまくいきません。
div 要素に名前を表示するだけです。
(function($) {
var Item = Backbone.Model.extend({
urlRoot: '/api/camp/1/'
});
var ListView = Backbone.View.extend({
el: '#reward_view',
initialize: function() {
_.bindAll(this, 'render'); // every function that uses 'this' as the current object should be in here
},
render: function() {
console.log(this)
$(this.el).html('<h1>Hello' + this.model.get('name') + '</h1>');
return this; // for chainable calls, like .render().el
}
});
var reward_view = new ListView();
})(jQuery);