首页 > 解决方案 > 如何在角度 7 的页面加载上打开 ng-bootstrap 模式弹出窗口?

问题描述

我无法在 Angular 7 页面加载时显示 ng-bootstrap 模式弹出窗口。

我试过下面的代码来打开它。

openVerticallyCentered(content) {

this.modalService.open(content, { centered: true });.
this.modalService.open(content, { beforeDismiss: false });

}

标签: angularbootstrap-modalng-bootstrapmodalpopup

解决方案


您应该使用 ViewChild 装饰器来访问 init 上的内容。

演示在这里。 https://stackblitz.com/edit/angular-rd8tny?embed=1&file=app/modal-basic.ts


推荐阅读