angular - 使用引导程序在 Angular 中没有字形图标输出
问题描述
我正在尝试输出glyphicon-star。我已经安装了引导程序,并使用 angular cli创建了一个名为favorite的组件。这是我最喜欢的.component.html 的内容
<span class="glyphicon glyphicon-star"></span>
以下是我最喜欢的.component.ts 的内容
@Component({
selector: 'favorite',
templateUrl: './favorite.component.html',
styleUrls: ['./favorite.component.css']
})
export class FavoriteComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
以下是我的app.component.html的内容
<favorite></favorite>
有时我会[WDS] 断开连接!错误。但我没有得到想要的输出。我试过执行npm update
PS:当我尝试显示主按钮时,它工作正常。
解决方案
你需要安装 Bootstrap 和 jQuery
例子:
cd myProject npm install --save bootstrap jquery
更新 angular.json:
例子:
{ ... "projects": { "contactsapp": { ... "architect": { "build": { ... "styles": [ "src/styles.css", "node_modules/bootstrap/dist/css/bootstrap.min.css" ... "scripts": [ "node_modules/jquery/dist/jquery.min.js", "node_modules/bootstrap/dist/js/bootstrap.min.js" ]
在模板中使用 Bootstrap
示例:喜爱的.component.html
<span class="glyphicon glyphicon-star"></span>
如果您仍然遇到问题/疑问,我发现本教程很有帮助:
推荐阅读
- r - 查找所有变量对之间的相交长度
- haskell - 哈斯克尔。两个列表的 INNER JOIN
- python - 在使用 groupby 函数进行分组并尝试打印数据框后,它缺少我分组的列中的值
- java - 设置纸牌游戏进入无限循环,有 2 名玩家
- python - 如何通过蓝图使用 Flask 登录
- windows-10 - Windows userprofile 文件夹根据访问方式显示不同的项目
- javascript - React-Leaflet Map 不更新
- javascript - 在 React Native 中单击图标播放音频剪辑
- rest - Tibco BW 条件流
- sql - SQL:连接表格并将每个单元格除以另一个表格中的匹配单元格?