Skip to content

Commit 59cae08

Browse files
DESTROY THE BUILDER
1 parent b5e68c0 commit 59cae08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

projects/angular-formio/embed/src/builder.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ElementRef, Input, ViewChild, Output, EventEmitter, AfterViewInit } from '@angular/core';
1+
import {Component, ElementRef, Input, ViewChild, Output, EventEmitter, AfterViewInit, OnDestroy} from '@angular/core';
22
import {Form, FormBuilder, Webform} from '@formio/js';
33
import WebformBuilder from '@formio/js/lib/cjs/WebformBuilder';
44

@@ -7,7 +7,7 @@ import WebformBuilder from '@formio/js/lib/cjs/WebformBuilder';
77
template: '<div #formio></div>',
88
standalone: false
99
})
10-
export class FormioBuilder implements AfterViewInit {
10+
export class FormioBuilder implements AfterViewInit, OnDestroy {
1111
@ViewChild('formio') element: ElementRef;
1212
@Input() form?: Form['options'] | null;
1313
@Input() options?: FormBuilder['options'] = {};
@@ -66,4 +66,8 @@ export class FormioBuilder implements AfterViewInit {
6666
this.ready.emit(this.instance);
6767
}).catch((err) => this.error.emit(err));
6868
}
69+
70+
ngOnDestroy(): void {
71+
this.instance.destroy(true);
72+
}
6973
}

0 commit comments

Comments
 (0)