如何更改 Angular CLI 图标 [英] How to change Angular CLI favicon

查看:23
本文介绍了如何更改 Angular CLI 图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改 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">

推荐答案

制作一个同名的 png 图像 (favicon.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

对于 angular 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆