Search code examples
angularpathassets

Angular Image Path


This question is from the open source project.

All images are stored in assets folder and the file is located in app/customer folder from where the code to load images is specified. The code is -

<img src="assets//images/{{customer.gender | lowercase}}.png" class="details-image" alt="">

The folder structure is -

-app
 -customer
  -fileLocation
-assets
 -images
  -image1.png

The images load properly. My question is - 'How the images are loading even the files are located at different levels? I cannot see the settings anywhere.


Solution

  • if you are using angular6 you are customize your assets in angular.json file for angular4/5 you can .angular-cli.json

    enter image description here In the screenshot you can see the path hierarchy for assets.


    Also when you build your project ng build, then from the generated dist folder you can see the assets folder path relation to index.html file enter image description here