angularjs-dragula
angularjs-dragula copied to clipboard
drake container is not removed when dom element is removed
My view adds and removes containers based on a switch the user clicks (I need to add/remove instead of show/hide because of performance). I noticed the directive does not remove the container from the drake.containers array when it is destroyed. This causes the models and containers to get out of sync because the container array just keeps growing.
I propose adding the following destroy listener to the directive. Let me know if you need a PR for this.
scope.$on('$destroy', function() {
var containerIndex = drake.containers.indexOf(container);
if (containerIndex >= 0) {
drake.containers.splice(containerIndex, 1);
}
});
someone looking into this?