如何更改Angular CLI图标 [英] How to change Angular CLI favicon
问题描述
如何更改由Angular CLI设置的默认图标?
How can I change the default favicon that is set by the Angular CLI?
我尝试了很多事情,但始终将Angular徽标显示为收藏图标, 即使我删除了该图标(src文件夹中的favicon.ico).它仍然显示,我不知道从哪里加载.
I have tried many things, but it always shows the Angular logo as the favicon, even though I have deleted that icon (favicon.ico in src folder). It still shows, and I don't know from where it's loaded from.
我已用另一个图标替换了该图标,但它仍显示Angular徽标:
I have replaced that icon with another icon, but it still show the Angular logo:
<link rel="icon" type="image/x-icon" href="favicon.ico">
推荐答案
制作具有相同名称(favicon.png
)的png图像并更改这些文件中的名称:
Make a png image with same name (favicon.png
) and change the name in these files:
index.html
:
<link rel="icon" type="image/x-icon" href="favicon.png" />
angular-cli.json
:
"assets": [
"assets",
"favicon.png"
],
您将永远不会再看到有角度的默认图标.
And you will never see the angular default icon again.
尺寸应为32x32,如果超出此尺寸,则不会显示.
Size should be 32x32, if more than this it will not display.
注意: 这不适用于Angular 9
NOTE: This will not work with Angular 9
对于角度9,您必须将favicon放入资产中,然后给出类似的路径
For angular 9 you have to put favicon inside assets then give path like
<link rel="icon" type="image/x-icon" href="assets/favicon.png">
这篇关于如何更改Angular CLI图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!