Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent MatDialog from being dragged out of the window

I am currently working on an Angular project. I use the MatDialog from Angular material together with the Angular module of drag and drop. I want to prevent the dialog from being dragged outside of the screen window. Does anyone know how to do this?

Thanks in advance.

like image 706
ines Avatar asked Dec 23 '22 20:12

ines


1 Answers

You can set cdkDragBoundary to .cdk-overlay-container which has the size of the screen.

Stackblitz

like image 123
Eldar Avatar answered Dec 28 '22 09:12

Eldar