集合是否具有与urlRoot
类似的属性?
我的收藏集当前设置为:
Entities.Notifications = Entities.Collection.extend({
model: Entities.Notification,
url: '/notifications'
});
提取时, /notification
会附加到域名之后。我该怎么做:
Entities.Notifications = Entities.Collection.extend({
model: Entities.Notification,
url: 'https://www.differentdomain.com/notifications'
});
因此它从其他来源获取数据吗?
答案 0 :(得分:1)
基于example from the docs,如果您将URL定义为一个函数,则不应执行附加操作,例如:
var Notes = Backbone.Collection.extend({
url: function() {
return 'https://www.differentdomain.com/notifications';
}
});