我在我的元素中使用 ng bootstrap。我所要做的就是打开一个模态。我读了一个similar thread但是那里没有包含 bootstrap css。
我正在关注 this示例。
当我单击按钮打开模态框时,模态框会附加到 DOM 中(使用开发工具检查时可见),但在屏幕上不可见。
我在我的 .angular-cli.json 中包含了 bootstrap css
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],
当查看页面源代码时,在 styles.bundle.js 中也可以看到 Bootstrap css。
编辑 1: 检查时,ngb-modal-window 的不透明度设置为 0。当我将其设置为 1 时,弹出窗口变得可见。但是弹出窗口的位置不在中心。它被拉到顶部。请引用图片:
最佳答案
你可以在css中包含
@import url('../node_modules/bootstrap/dist/css/bootstrap.min.css');
in 'styles.css'
在某些情况下,ngx-bootstrap 在 Angular 2/4 中无法完全按照预期工作。
关于css - Angular + ng bootstrap 模式没有出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47428586/