バックボーン モデルの親にプロパティを設定したいと考えています。
MN.BaseModel = Backbone.Model.extend ({
iWantToSetThisVar : false,
initialize : function(){
},
parse: function(response) {
console.log(this.iWantToSetThisVar); //should now be true
}
});
上記のモデルを拡張しません
MN.Contact = MN.BaseModel.extend({
initialize : function(){
this.iWantToSetThisVar = true;
},
});
これで、MN.Contact で parse が呼び出されると、BaseModel から parse 関数が呼び出されます。ただし、「iWantToSetThisVar」は baseModel で true に変更されていません。