Are these two steps mandatory to delete a Model?
var model = collection.get(id);
model.destroy();
collection.remove(model);
Isn't there a way to destroy a model when it is removed from its collection?
backbone.jscollectionsmodel
Are these two steps mandatory to delete a Model?
var model = collection.get(id);
model.destroy();
collection.remove(model);
Isn't there a way to destroy a model when it is removed from its collection?
Best Answer
Removing a model from a collection triggers the
"remove"
event.So if you want to, you can get models to bind to them and destroy themselves.