【发布时间】:2021-05-16 09:06:20
【问题描述】:
我已经嵌套了一些不同的 Angular 模块。每个人都有自己的服务等。 问题是当我想从嵌入式模块打开模式窗口时:这些元素打开并且工作正常,但在它自己的模块内部。 我已经搜索过,但找不到任何特定的解决方案来打开所有组件之外的模式窗口(在浏览器主区域,如常规模式窗口)。
显示实际结果的 GIF:
我尝试更改 z-index(在主类上,分隔一个,在 html 标记中硬编码)、禁用背景和许多其他(讨厌的)技巧,但似乎都没有解决这个问题。
html 看起来像这样:
<div bsModal #modalFormPlanta="bs-modal" [config]="{backdrop: false}">
<div class="modal-dialog modal-md">
<div class="modal-content">
<app-formulario-planta-cliente *ngIf="showFormAddPlanta" [Client]="Client" [action]="PlantaSeleccionada?.id != null" [element]="PlantaSeleccionada" (finish)="closeFormPlanta($event)"></app-formulario-planta-cliente>
</div>
</div>
此元素位于 html 文件的末尾。除了<div>
已经在 bsModal 上尝试过:
style="z-index: 9999 !important"
tabindex="-1"
class="modal fade"
data-backdrop="false"
以及这个组件的相关代码:
@ViewChild('modalFormPlanta') modalFormPlanta: ModalDirective;
public openEditForm(elem) {
this.PlantaSeleccionada = elem;
this.showFormAddPlanta = true;
this.modalFormPlanta.show();
}
public closeFormPlanta(event) {
if (event) {
this.PlantaSeleccionada.Cliente = event;
this.loadPlantas();
}
this.modalFormPlanta.hide();
}
你能建议我任何解决方案来打开浏览器区域上的每个模式窗口(不在任何组件内)。
非常感谢!
【问题讨论】:
标签: angular modal-dialog frontend