1
我想加載另一個模板並在使用model.destroy()刪除我的DOM元素時應用動畫。 當我使用類似下面如何在刪除模型時使用另一個模板:backbone.js&marionettejs
_onCollectionRemove: function(model) {
var view = this.children.findByModel(model);
view.template = require('handlebars').compile(require('myTemplatePath'));
view.render();
view.$el.fadeToggle(300, 'linear'); // For animation
var func = _.bind(function() {
this.removeChildView(view);
this.checkEmpty();
}, this);
setTimeout(func, 300);
}
但是,當過_onCollectionRemove所謂舊的,我想刪除呈現,而不是新的模板,模板的答案Backbone.js `model.destroy()` custom transitions? 的一個描述。