How to change Angular CLI favicon

后端 未结 30 1482
谎友^
谎友^ 2020-12-07 16:32

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 hav

相关标签:
30条回答
  • 2020-12-07 16:41

    I was playing around with this for a little while. Turns out that the favicon is apparently handled by a node module called @scematics (at least in Angular5).

    You can change your favicon in this folder:

    [YourProjectName]\node_modules\@schematics\angular\application\files\__sourcedir__
    

    In that folder there should be a favicon.ico, that's the one that is loaded. Im pretty shure this doesnt apply to everyone but it worked out for me.

    Hope this helped. Happy coding! :D

    0 讨论(0)
  • 2020-12-07 16:42

    I tried many of these solution but was unsuccessful. The one that worked for my angular 5 application was the below:

    index.html: Comment out your link tag

     <!-- <link rel="icon" type="image/png" href="src/assets/images/favicon.ico"> --> 
    

    .angular-cli.json: leave the item type as ".ico"

     "assets": [
          "assets",
          "favicon.ico"
        ],
    

    LASTLY..

    • In your project folder structure, have the favicon.ico inside the src ex: (C:\Dev\EPS\src). You do NOT need to have it in your asset folder since you aren't referencing it.

    • Make sure your icon is not broken (Your icon should be readable if viewed through window explorer aka no broken window icon)

    • must be 32 x 32 dimension
    0 讨论(0)
  • 2020-12-07 16:42
    <link rel="icon" type="image/x-icon" href="assets/liana.jpg">
    
    "assets": [
    
            "assets/sorry.jpg",
            "assets/liana.jpg"
    
      ],
    

    this worked for me.

    0 讨论(0)
  • 2020-12-07 16:44

    TO RELOAD FAVICON FOR ANY WEB PROJECT:

    Right click on the favicon and click 'reload'. Works every time.

    0 讨论(0)
  • 2020-12-07 16:44

    Make sure when you use icon image it is not manipulated extension, like if you download a png image and then manually change its extension from png to icon. In this case, your image will be corrupted. And browser does not understand.

    I did this mistake, but after using original icon image its start working.

    0 讨论(0)
  • 2020-12-07 16:49

    Deleting chromes favicon cache and restarting the browser on the mac worked for me.

    rm ~/Library/Application\ Support/Google/Chrome/Default/Favicons
    
    0 讨论(0)
提交回复
热议问题