如何在 angular 7 的页面加载中打开 ng-bootstrap 模态弹出窗口?

Ati*_*zad 1 modalpopup bootstrap-modal ng-bootstrap angular

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

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

openVerticallyCentered(content) {

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

}
Run Code Online (Sandbox Code Playgroud)

小智 5

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

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