I have a collection from which I would like to delete a model and have it sync in real-time:
var ClientCollection = Backbone.Firebase.Collection.extend({
model: Client,
url: "https://<my-firebase-url>.firebaseio.com",
autoSync: true
});
I have tried the following from the collection veiw using my clear
function:
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();
},
});
However this only removes the model from the DOM.
How do I delete the model from the server AND the DOM?