четверг, 12 марта 2015 г.

Backbone.js. Remove model from collection without a reference to collection.

What if you have a model in a collection and in a model view you need to remove model from the collection. You can call destroy method on a model, but this will trigger the ajax delete method to the server.
Well, you can trigger the destroy event on a model like this: this.model.trigger('destroy',this.model).
And you model will be deleted from the collection and no DELETE method will be sent to the server.

Комментариев нет:

Отправить комментарий