For ConfirmDialog there is a property - appendTo 
Using this property we can append dialog to any element. I don't see such property for DynamicDialog.
Is there any way to append DynamicDialog to some element, not to body?
Copyright © 2021 Jogjafile Inc.
Based on dialogservice impl, appendTo is not possible, as you can see below, dialog service appends component by default to the body.:
https://github.com/primefaces/primeng/blob/master/src/app/components/dynamicdialog/dialogservice.ts