Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Backbone.js中使用Remove事件检测从集合中删除的模型_Backbone.js_Underscore.js_Backbone.js Collections - Fatal编程技术网

在Backbone.js中使用Remove事件检测从集合中删除的模型

在Backbone.js中使用Remove事件检测从集合中删除的模型,backbone.js,underscore.js,backbone.js-collections,Backbone.js,Underscore.js,Backbone.js Collections,我的问题是,当我们绑定/侦听集合的add事件时,是否有方法检测从集合中删除的模型 例如: this.listenTo(monthsOnBoardCollection, "remove", function(){ //is it possible here to find what got removed from the collection ? } 您有显示传递给事件的参数的 "remove" (model, collection, options) — when a model is

我的问题是,当我们绑定/侦听集合的add事件时,是否有方法检测从集合中删除的模型

例如:

this.listenTo(monthsOnBoardCollection, "remove", function(){
  //is it possible here to find what got removed from the collection ? 
}
您有显示传递给事件的参数的

"remove" (model, collection, options) — when a model is removed from a collection.
所以基本上是:

this.listenTo(monthsOnBoardCollection, "remove", function(model, collection, options){
  //now you have the model, the collection and the options which were passed to the remove method
}