IM,试图做什么IM是是显示一个笑话每个用户点击一个事件.get_joke时间:我的继承人骨干的应用程序代码:骨干模型属性没有定义?利用骨干,构建我的客户端应用程序
JokeModel = Backbone.Model.extend({
url: '/jokes'
initialize: function() {
this.fetch();
}
});
JokeView = Backbone.View.extend({
template: _.template("<p><%= joke %></p>")
events: {
"click .get_joke" : "render"
}
render: function() {
var newJoke = new JokeModel;
$(this.el).html(this.template(newJoke.toJSON()));
}
});
newJokeView = new JokeView;
问题时,我点击.get_joke它deosnt呈现笑话来看,我知道该模型已被提取,因为我用的console.log检查,但它说笑话尚未确定,但我dont't知道问题出在哪里。感谢