From d89afc8eec660abcd509659d147c1e93b46e2071 Mon Sep 17 00:00:00 2001 From: maruthumj Date: Thu, 26 Oct 2023 10:38:28 +0530 Subject: [PATCH] appended elements getting removed after the ngondestroy --- src/app/components/contextmenu/contextmenu.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/components/contextmenu/contextmenu.ts b/src/app/components/contextmenu/contextmenu.ts index 1d55827c471..a4dd69a6a68 100755 --- a/src/app/components/contextmenu/contextmenu.ts +++ b/src/app/components/contextmenu/contextmenu.ts @@ -1148,9 +1148,17 @@ export class ContextMenu implements OnInit, AfterContentInit, OnDestroy { } } + removeAppendedElements(){ + if (this.appendTo) { + if (this.appendTo === 'body') this.renderer.removeChild(this.document.body, this.containerViewChild.nativeElement); + else DomHandler.removeChild(this.containerViewChild.nativeElement, this.appendTo); + } + } + ngOnDestroy() { this.unbindGlobalListeners(); this.unbindTriggerEventListener(); + this.removeAppendedElements(); } }