简体   繁体   English

使用 NgbModal.open() 方法打开新的模态窗口时如何添加多个选项?

[英]How do I add multiple options when opening new modal windows with NgbModal.open() method?

I have created a ngbModal using ng-bootstrap.我使用 ng-bootstrap 创建了一个 ngbModal。 I would like to add multiple NgbModalOptions.我想添加多个 NgbModalOptions。 ie: { size: 'lg' } and { scrollable: true }.即:{ size: 'lg' } 和 { scrollable: true }。

I have tried writing it in one line separated by commas, it did not work.我试过把它写在用逗号分隔的一行中,它没有用。

open() {
    return this.modalService.open(content, { size: 'lg', scrollable: true });
  }

Argument of type '{size: "lg"; '{size: "lg"; 类型的参数scrollable: boolean;可滚动:布尔值; }' is not assignable to parameter of type 'NgbModalOptions'. }' 不能分配给'NgbModalOptions' 类型的参数。 Object literal may only specify known properties, and 'scrollable' does not exist in type 'NgbModalOptions'.对象字面量只能指定已知属性,并且“NgbModalOptions”类型中不存在“scrollable”。

The reason the scrollable options does not work is due to the fact that I am using Angular 7 and scrollable option needs a minimum version requirement of Angular 8 and ng-bootstrap version 5.可滚动选项不起作用的原因是因为我使用的是 Angular 7,并且可滚动选项需要 Angular 8 和 ng-bootstrap 版本 5 的最低版本要求。

Read this for more info: https://github.com/ng-bootstrap/ng-bootstrap/issues/3281阅读更多信息: https : //github.com/ng-bootstrap/ng-bootstrap/issues/3281

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM