fix chart would not be destoried when that is unused

master
MaysWind 2017-09-03 15:49:42 +08:00
parent 213b53f5ef
commit 031a8dabcc
1 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,12 @@
setOptions(value);
}
}, true);
scope.$on('$destroy', function() {
if (chart && !chart.isDisposed()) {
chart.dispose();
}
});
}
};
}]).directive('ngPopChart', ['$window', 'chartTheme', function ($window, chartTheme) {
@ -79,7 +85,7 @@
chart = echarts.init(wrapper[0], chartTheme.get(options.ngTheme));
}).on('hide.bs.popover', function () {
if (chart && chart.isDisposed()) {
if (chart && !chart.isDisposed()) {
chart.dispose();
}
}).on('hidden.bs.popover', function () {