ng-bootstrap Modal size

前端 未结 9 2188
抹茶落季
抹茶落季 2020-12-29 18:25

What is the best way to set/override a custom width for a modal?

It seems ng-bootstrap currently supports

size: \'sm\' | \'lg\'

9条回答
  •  误落风尘
    2020-12-29 18:59

    I found this as a good solution.

    this.modalService.open(MyComponent, { windowClass: 'my-class'});
    

    ng-deep “shadow-piercing” descendant combinator can be used to force a style down through the child component tree into all the child component views. In this case modal-dialog class.

    ::ng-deep .my-class .modal-dialog { 
         max-width: 80%;
         width: 80%;
    }
    

提交回复
热议问题