關於同一個錯誤有很多問題,但這個是不同的,也很奇怪。Backbone.js同步:必須指定一個「url」屬性或函數
這裏是正在生成的錯誤代碼:
console.log(this.sources.url);
this.sources.sync({
success: function (collection, response, options) {
App.debug('Synchronized media sources.');
},
error: function (collection, response, options) {
App.debug('Unable to synchronize media sources.')
App.debug(response);
}
});
this.sources是一個集合。輸出是:
/api/sources
routes.js:40 Uncaught Error: A "url" property or function must be specified
所以指定一個url。有任何想法嗎?
不過不知道爲什麼這是怎麼回事,但我找到了一個解決方法。我使用同步而不是抓取,因爲我想聽同步事件。然後我意識到提取也會觸發同步事件,並且切換到提取可以修復問題。 – elplatt