How to avoid memory leaks using angularjs-nvd3-directives
问题 I'm working on an angularjs application using angularjs-nvd3-directives to render charts. After a check with Chrome Developer Tools, I detected some memory leaks linked to the charts. When the user navigates through different views containing charts the memory is never fully released. I'm already doing some cleanup on the graphs controllers: $scope.$on('$destroy', function() { d3.select( '#exampleId' ).remove(); d3.select( '#exampleId2' ).remove(); ... }); And on the routeChange event: myApp