我从 bootswatch superhero 下载了 bootstrap.min.css 并在我的 index.html 头元素中执行此操作:
<link href="css/bootstrap.min.css" rel="stylesheet"/>
但是 glyphicon-star 不工作。 因此,如果在我的指令 js 文件中有:
template: '<span ng-repeat="star in vm.stars track by $index" class="glyphicon glyphicon-star">{{ star }}</span>',
没有任何显示,而如果我做一些非常基本的事情,例如:
template: '<ul> <li ng-repeat="star in vm.stars track by $index" >{{ star }}</li></ul>'
我确实看到了列表项的元素符号。 vm.stars 是一个数组,长度为 1 到 5。 为什么字形不显示?是否依赖于bootstrap.min.css的版本?
最佳答案
解决方案是下载完整的 bootstrap 并将从 bootswatch/superhero 下载的 bootstrap.min.css 替换为 bootstrap 发行版中的那个(我选择了 3.3.7)。 如果您打开 bootstrap.min.css 并搜索字形,则会找到匹配项,而在 bootswatch/superhero 的 bootstrap.min.css 中则没有匹配项。 另一件事是将字体目录从 bootstrap zip 复制到我的 AngularJS 应用程序的公共(public)目录。 这解决了问题,现在我看到星星了。
关于css - 包括 bootstrap.min.css 但 glyphicon-star 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57172131/