【发布时间】:2020-08-26 17:19:15
【问题描述】:
我想以大格式显示一个 ngx-bootstrap 模态。
为此有两个类:modal-dialog-centered 和 modal-lg,但我看不出有任何方法可以同时应用这些类。
在这里查看ngx-bootstrap source code 时:modal-options.class.ts
有一个可选的class property 定义为class?: string;。但它没有定义为我们可以应用的类数组。
所以现在我可以显示居中的模态:
this.bsModalRef = this.modalService.show(ConfirmationComponent,
{class: 'modal-dialog-centered', initialState});
或大模态但不居中:
this.bsModalRef = this.modalService.show(ModalConfirmationComponent,
{class: 'modal-lg', initialState});
我尝试将此添加到模态的开始模板:
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
...
但也没有运气,modal-lg 的班级不想工作
有人知道如何让它工作吗?
更新
这个 CSS 看起来会给出一些结果,但表现得并不完全好:
::ng-deep .modal.show .modal-dialog {
-webkit-transform: translate(50%, 50%);
transform: translate(0%, 50%);
}
【问题讨论】:
-
{class: 'modal-dialog-centered modal-lg', initialState}..?
-
@MikeOne:是的,它就是这样工作的,官方文档中是否对此进行了解释?
标签: css angular ngx-bootstrap ngx-bootstrap-modal