From 59cae086ffcc760c556d751bc4d7b4d55623e562 Mon Sep 17 00:00:00 2001 From: ZenMasterJacob20011 Date: Thu, 13 Mar 2025 20:07:15 -0500 Subject: [PATCH] DESTROY THE BUILDER --- projects/angular-formio/embed/src/builder.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/angular-formio/embed/src/builder.component.ts b/projects/angular-formio/embed/src/builder.component.ts index 844264a4..786f3e2b 100644 --- a/projects/angular-formio/embed/src/builder.component.ts +++ b/projects/angular-formio/embed/src/builder.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, Input, ViewChild, Output, EventEmitter, AfterViewInit } from '@angular/core'; +import {Component, ElementRef, Input, ViewChild, Output, EventEmitter, AfterViewInit, OnDestroy} from '@angular/core'; import {Form, FormBuilder, Webform} from '@formio/js'; import WebformBuilder from '@formio/js/lib/cjs/WebformBuilder'; @@ -7,7 +7,7 @@ import WebformBuilder from '@formio/js/lib/cjs/WebformBuilder'; template: '
', standalone: false }) -export class FormioBuilder implements AfterViewInit { +export class FormioBuilder implements AfterViewInit, OnDestroy { @ViewChild('formio') element: ElementRef; @Input() form?: Form['options'] | null; @Input() options?: FormBuilder['options'] = {}; @@ -66,4 +66,8 @@ export class FormioBuilder implements AfterViewInit { this.ready.emit(this.instance); }).catch((err) => this.error.emit(err)); } + + ngOnDestroy(): void { + this.instance.destroy(true); + } }