How to change Angular CLI favicon
How can I change the default favicon that is set by the Angular CLI?
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.
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">
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.
Size should be 32x32, if more than this it will not display.
NOTE: This will not work with Angular 9
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">
Since you have replaced the favicon.ico
file physically, there must be a caching issue somewhere. There is a cache in your browser. Force it to get flushed by pressing Ctrl+F5.
If the default icon is still displayed, try another browser with a clean cache (i.e. you haven't visited the page with that browser yet).
Clear Cache Shortcuts: (Source)
Windows
IE:Ctrl+R; Firefox:Ctrl+Shift+R; Chrome:Ctrl+R, or Ctrl+F5, or Shift+F5.
Mac
Safari:⌘+R; Firefox/Chrome:⌘+Shift+R.