Can someone explain to me what the 'this' in "this.model.toJSON()" refers to? I'm reasoning that the 'this' should refer to the object ContactView
, since that is the object that its located in. But that doesn't seem to be the case. Is 'this.model' connected to the variable Contact?
var Contact = Backbone.Model.extend({
defaults: {
photo: "/img/placeholder.png"
}
});
var ContactView = Backbone.View.extend({
tagName: "article",
className: "contact-container",
template: $("#contactTemplate").html(),
render: function () {
var tmpl = _.template(this.template);
this.$el.html(tmpl(this.model.toJSON()));
return this;
}
});