2014-02-19 156 views
0

我只是簡單地創建一個集合並對其進行獲取調用,但它給出了以下錯誤。我的骨幹版本是1.1骨幹模型屬性錯誤

我已經完成了R & D(例如SO),但仍然無法解決問題。

class MyApp.Collections.ProjectsCollection extends Backbone.Collection 
    model: MyApp.Models.Project 
    url: '/projects' 

class MyApp.Models.Project extends Backbone.Model 
    urlRoot: 'project' 
    idAttribute: 'objectId' 

projects = new MyApp.Collections.ProjectsCollection() 
projects.fetch(reset: true) 

這裏的其中骨幹顯示

// Prepare a model or hash of attributes to be added to this collection. 
_prepareModel: function(attrs, options) { 
    if (attrs instanceof Model) { 
    if (!attrs.collection) attrs.collection = this; 
    return attrs; 
    } 
    options || (options = {}); 
    options.collection = this; 
    var model = new this.model(attrs, options); 
    if (!model._validate(attrs, options)) return false; 
    return model; 
}, 
+0

哪裏錯誤? – Puigcerber

回答

1

錯誤試試這個.. projects.fetch({重置:真})