How to make Angular Material Dialog re sizable in Angular 7?

后端 未结 2 1501
无人及你
无人及你 2020-12-21 22:58

I am using angular material dialog and AngularJS 7. I am able to drag the dialog but I want to make that dialog re sizable so that used can

2条回答
  •  执笔经年
    2020-12-21 23:33

    From my experience, you can overwrite max-width properties of overlay wrapper, dialog container and define resize. You should end with something like that:

    .cdk-overlay-pane{
      width: unset !important;
      height: unset !important;
      max-width: 100% !important;
    }
    
    .mat-dialog-container{
      max-width: 100%;
      max-height: 100% !important;
      resize: both;
    }
    

    Tried to reproduce it: https://stackblitz.com/edit/angular-material-dialog-resize-vbom8f?file=src%2Fstyles.css

    Works, but only with !important statement. Try to play with your code to find a workaround to not use it. I'm sure you know, that !important isn't the best CSS practice.

提交回复
热议问题