Home > Software engineering >  How to change favicon.ico path in Angular?
How to change favicon.ico path in Angular?

Time:08-10

I am new to Angular. In my angular app environment, there will be a base path after DNS name like https://my-server-name/my-angular-app-name.

There is also a server side restriction like only requests that matches with base path of "my-angular-app-name", will pass through the server. All other requests that does not match the path will be terminated.

I was able to give the base path in the app using ng build --deploy-url /my-angular-app-name/ command. This command is adding a base path of /my-angular-app-name in all the Java Script files that index.html needs. But this command is not updating the path of favicon.ico file.

Is there any ways that I can give a custom path to favicon.ico file?

CodePudding user response:

  1. Add your favicon inside the src folder.

  2. Open the heindex.html file and change the favicon file name (with the newly added icon name).

<link rel="icon" type="image/x-icon" href="favicon.ico"/>

Inside the angular.json file add the favicon in assets array.

Reference here

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

CodePudding user response:

Dis you check the config in angular.json and in manifest.json ?

  • Related