Skip to content

Commit e629edf

Browse files
committed
Release resources in $on('$destroy') - fixes major memory leak
1 parent 2ea9711 commit e629edf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/angular-fusioncharts.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@
451451

452452
createFCChart();
453453

454+
scope.$on('$destroy', function () {
455+
// on destroy free used resources to avoid memory leaks
456+
if (chart && chart.dispose) {
457+
chart.dispose();
458+
}
459+
});
454460
}
455461
};
456462
}]);

0 commit comments

Comments
 (0)