【问题标题】:ng-bootstrap modal not appearingng-bootstrap 模式没有出现
【发布时间】:2018-05-22 18:37:13
【问题描述】:

在我的 Angular 5 应用程序中,我正在使用 ng-bootstrap,但它没有出现。我只是想用打字稿的正常方式打开它:

private modalRef: NgbModalRef;

constructor(private modalService: NgbModal) {}

openModal(content) {
    this.modalRef = this.modalService.open(content);
}

通过一个超级简单的 HTML 测试。

<ng-template #content let-c="close" let-d="dismiss">
    Hi mom!
</ng-template>

<button class="btn btn-lg btn-primary" 
        (click)="openModal(content)">Add AR</button>

我看到我的 openModal 实际上正在被调用,但对话框没有出现。控制台也没有错误。

【问题讨论】:

  • 你是否包含了 Bootstrap 4 CSS?
  • 射击。我认为它包括旧版本的引导程序。它使用了我们公司的“外观和感觉”包括。

标签: bootstrap-modal ng-bootstrap


【解决方案1】:

试试:

<ng-template #content let-c="close" let-d="dismiss">
    Hi mom!
<button class="btn btn-lg btn-primary" 
        (click)="openModal(content)">Add AR</button>
</ng-template>

【讨论】:

  • 虽然此代码可能会解决问题,但 including an explanation 关于如何以及为什么解决问题将真正有助于提高您的帖子质量,并可能导致更多的赞成票。请记住,您正在为将来的读者回答问题,而不仅仅是现在提出问题的人。请edit您的答案添加解释并说明适用的限制和假设。
猜你喜欢
  • 2012-07-14
  • 1970-01-01
  • 2019-08-27
  • 1970-01-01
  • 1970-01-01
  • 2014-03-31
  • 2017-09-20
  • 2018-08-04
  • 1970-01-01
相关资源
最近更新 更多