Thursday, 8 August 2013

Backbone "has no method 'call'" error

Backbone "has no method 'call'" error

I have view like this:
var PostView = Backbone.View.extend({ template: _.template(postTemplate),
events: {
'click .reply': 'addComment',
'keypress textarea': 'addCommentOnEnter'
},
initialize: function(){
_.bindAll(this, "render", "addcomment" , "addcommentOnEnter");
this.model.bind('change', this.render);
},
addComment : function(){
this.model.comment($(".post-area").val());
},
addCommentOnEnter : function(e){
if (e.keyCode != 13) return;
this.model.comment($(".post-area").val());
},
render: function(){
this.$el.html(this.template(this.model.toJSON()));
}
});
and whenever I click on .reply or press enter, meaning whenever addComment
or addCommentOnEnter is called I get and error on my console like this:

I have no idea what that means, but it doesnt seem to break anything in
the application

No comments:

Post a Comment