Skip to content

Commit 39d20a7

Browse files
committed
fix(angular): add OnDestroy cleanup to example component
1 parent 854f4d9 commit 39d20a7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

examples/getting-started/angular/src/app/app.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ElementRef, ViewChild } from '@angular/core';
1+
import { Component, ElementRef, ViewChild, OnDestroy } from '@angular/core';
22
import { SuperDoc } from 'superdoc';
33

44
@Component({
@@ -10,7 +10,7 @@ import { SuperDoc } from 'superdoc';
1010
<div #editor style="height: calc(100vh - 60px)"></div>
1111
`,
1212
})
13-
export class AppComponent {
13+
export class AppComponent implements OnDestroy {
1414
@ViewChild('editor', { static: true }) editorRef!: ElementRef;
1515

1616
private superdoc: SuperDoc | null = null;
@@ -26,4 +26,8 @@ export class AppComponent {
2626
document: file,
2727
});
2828
}
29+
30+
ngOnDestroy() {
31+
this.superdoc?.destroy();
32+
}
2933
}

0 commit comments

Comments
 (0)