Skip to content

Commit

Permalink
Merge pull request #14796 from adrikum/fix/14793-contextmenu-appendto
Browse files Browse the repository at this point in the history
Fix: #14793 check if containerViewChild exists before removing
  • Loading branch information
cetincakiroglu committed Feb 23, 2024
2 parents e333bf5 + 36c4a46 commit e5518fd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/app/components/contextmenu/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1182,11 +1182,9 @@ export class ContextMenu implements OnInit, AfterContentInit, OnDestroy {
}

removeAppendedElements() {
if (this.appendTo) {
if (this.appendTo && this.containerViewChild) {
if (this.appendTo === 'body') {
if (this.containerViewChild) {
this.renderer.removeChild(this.document.body, this.containerViewChild.nativeElement);
}
this.renderer.removeChild(this.document.body, this.containerViewChild.nativeElement);
} else {
DomHandler.removeChild(this.containerViewChild.nativeElement, this.appendTo);
}
Expand Down

0 comments on commit e5518fd

Please sign in to comment.