angularjs-dragula icon indicating copy to clipboard operation
angularjs-dragula copied to clipboard

drake container is not removed when dom element is removed

Open xsegrity opened this issue 8 years ago • 1 comments

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);
    }
});

xsegrity avatar May 10 '16 16:05 xsegrity

someone looking into this?

gsaandy avatar Nov 09 '16 13:11 gsaandy