0
我有一個集合從中我想刪除一個模型,有它在實時同步到刪除骨幹收集模式:如何利用火力地堡
var ClientCollection = Backbone.Firebase.Collection.extend({
model: Client,
url: "https://<my-firebase-url>.firebaseio.com",
autoSync: true
});
我試圖從集合教職員以下使用我的clear
功能:
var ClientView = Backbone.View.extend({
tagName: "li",
className: "list-group-item",
template: _.template("<%= name %>"),
events: {
"click .destroy" : "clear"
},
initialize: function() {
this.listenTo(this.model, "change", this.render);
},
render: function() {
this.$el.html(this.template(this.model.toJSON()));
return this;
},
clear: function() {
this.model.remove();
},
});
但是,這隻能從DOM中刪除模型。
如何從服務器和DOM中刪除模型?