Destroying a Backbone Model in a Collection in one step?

后端 未结 2 1628
既然无缘
既然无缘 2021-02-05 07:13

Are these two steps mandatory to delete a Model?

var model = collection.get(id);
model.destroy();
collection.remove(model);

Isn\'t there a way

2条回答
  •  感动是毒
    2021-02-05 07:48

    Calling collection.reset() without passing any models as arguments will empty the entire collection.

    http://backbonejs.org/#Collection-reset

提交回复
热议问题