angular 2 bootstrap CSS 未加载

angular 2 bootstrap CSS not loading

我用 ng-bootstrap 开始了一个新的 angular 2 项目。我可以看到 bootstrap js 工作正常,但不是 CSS。我是否需要明确地包括那些 CSS ,我怀疑是这种情况,但我也可能是错的。

我什至尝试在我的组件中添加 bootstrap.css,但没有任何反应。将它添加到 index.html 上确实有所不同,但我不想明确调用,除非没有其他方法。

谢谢,

由于您使用的是 angular-cli,因此您可以在 angular-cli.json 文件中添加全局 css 文件的路径以全局添加它:

"styles": [
   "../node_modules/path/to/bootstrap.css",
   "styles.css"
]

Bootstrap 4 不再支持 Glyphicon,因此根本原因是缺少字体而不是 css。

删除了 Glyphicons 图标字体。如果您需要图标,一些选项是: Glyphicons 的上游版本 八字形 字体真棒

来源:https://v4-alpha.getbootstrap.com/migration/