【发布时间】:2019-12-19 00:21:06
【问题描述】:
当用户选择提交按钮时,我会弹出一个确认模式。
当模态出现时,用户可以选择单击按钮来关闭模态。下面是它的样子:
HTML:
<ng-template #confirmModal>
<custom-modal-body-component
(cancelFn)="closeModal()"
</custom-modal-body-component>
</ng-template>
TS:
@ViewChild('confirmModal', { static: true }) confirmModalTemplate: TemplateRef<any>;
constructor(
private modalService: MatDialog,
) {}
submit() {
this.myModal = this.modalService.open(this.confirmModalTemplate);
}
closeModal() {
this.myModal.close();
}
我的问题是,当用户关闭模式时,它会在关闭前短暂移动到页面的左上角。我不希望这种情况发生。
我希望模态框能正常关闭而不跳到页面的左上角。我们最近将 Angular/material 从 7.x.x 升级到了 8.2.1。此问题未出现在版本 7 中,我们不想降级到 7。对可能发生的情况有什么想法吗?
这只发生在 IE 中,我们需要支持。
编辑: 应该注意的是,这种行为只发生在我们应用程序的两个特定页面上。我们在所有页面上以相同的方式打开模式,但此问题并非在所有页面上都存在。
【问题讨论】:
标签: html angular typescript angular-material modal-dialog