Angular -ng-bootstrap-NgbModal弹出窗口类属性不起作用

at0kjp5o  于 2022-12-07  发布在  Bootstrap
关注(0)|答案(1)|浏览(187)

我有一个模态弹出窗口,我想增加它的宽度。
这是Angular 编码

  1. openTaskDetails(content) {
  2. const options : NgbModalOptions={
  3. size : 'lg',
  4. windowClass :'mycustomClass'
  5. }
  6. this.modalService.open(content ,options).result.then((result) => {
  7. this.saveTask(result);
  8. }, (reason) => {
  9. console.log(reason);
  10. });
  11. }

并且CSS被

  1. .mycustomClass .modal-lg {
  2. width : 80% !important;
  3. max-width: 90% !important;
  4. background-color:red;
  5. }

size属性工作正常,但windowClass不正常。我试过了

  1. .mycustomClass {
  2. width : 80% !important;
  3. max-width: 90% !important;
  4. background-color:red;
  5. }

但是仍然存在同样的问题,弹出窗口的宽度没有增加。
当我检查元素时,我看到类名称mycustomClass插入到HTML中,但找不到css。

2izufjch

2izufjch1#

请在模态html中插入如下选项:

相关问题