Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard dispose #285

Merged
merged 2 commits into from
Jan 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions projects/ngx-echarts/src/lib/ngx-echarts.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class NgxEchartsDirective implements OnChanges, OnDestroy, OnInit, AfterV

private dispose() {
if (this.chart) {
this.chart.dispose();
if (!this.chart.isDisposed()) this.chart.dispose();
xieziyu marked this conversation as resolved.
Show resolved Hide resolved
this.chart = null;
}
}
Expand Down Expand Up @@ -163,7 +163,8 @@ export class NgxEchartsDirective implements OnChanges, OnDestroy, OnInit, AfterV
}

/**
* dispose old chart and create a new one.
*
old chart and create a new one.
xieziyu marked this conversation as resolved.
Show resolved Hide resolved
*/
async refreshChart() {
this.dispose();
Expand Down