I'm dynamically creating Angular component on click event using passed placeholder ViewContainerRef
reference
(method createComponent
). Then in the same method I'm using modal.open
to open a new NgbModal
dialog. Everything works smoothly, except dragging. With such approach unlike to my static markup dialogs, I cannot provide its draggable feature, because directive (cdkDragDrop
) doesn't work for dynamically created content as far as I understand. So how to resolve this issue? Any hints?
Asked
Active
Viewed 129 times
0

Alexander
- 1,152
- 1
- 16
- 18
1 Answers
0
I managed to make it in a bit hacky way:
this.notificationModalRef = this.modalService.open(notificationComponentRef.instance.notificationContent, { centered: true, size: 'xl', scrollable: true });
this.dragDrop.createDrag((this.notificationModalRef as any)._windowCmptRef.instance._dialogEl);

Alexander
- 1,152
- 1
- 16
- 18