2012-10-28 73 views
0

我使用從 GitHub的骨幹協會 https://github.com/dhruvaray/backbone-associations 嵌套模式的骨幹網與關聯到backnone工作。骨幹協會工作不與取

我在調用模型上的fetch()時出錯。來自服務器的響應json與模型定義完全匹配。我找不出我缺少的是什麼?

版本:

骨幹:0.9.2

骨幹的協會:0.2.0

類型錯誤:this.attributes [relationKey] .off不是函數 this.attributes [relationKey] .off(「all」);

//this is the code i am using.. 

var ProductVariation = Backbone.AssociatedModel.extend({ 
    defaults: { 
     ImageUrl:'', 
     Desc:'' 
    } 
}); 

var Product = Backbone.AssociatedModel.extend({ 
    relations: [{ 
     type: Backbone.Many, 
     key: 'ProductVariations', 
     relatedModel: ProductVariation 
    }], 
    url: '/GetProductById', 
    defaults: { 
     CategoryId: 0, 
     ProductVariations: [], 
     Summary: '' 
    } 
}); 

我錯過了什麼?任何幫助讚賞...

回答

0

哎呀這是我的錯......

其實我用的是舊版本BackboneJS的,但以爲我用的是最新的.. 不具有offon方法,而是分別使用bindunbind

用新的替換舊的是修復。