[SOLVED] Angular is not finding images in the assets if there are located in a sub folder

Issue

This Content is from Stack Overflow. Question asked by Richard77

I have a PNG image that I’d like to use as default if user didn’t upload an image. For an hour now, I couldn’t see the image.

<img src="assets/images/image-card.png" />

I tried to change the value of the asset in the angular.json, but it still didn’t work

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

Only when I moved the image directly to the assets itself then it worked.

Is that how it’s supposed to work? What if I have different types of files, can’t I organize them in folders (images, videos, texts, etc.)

Thanks for helping



Solution

Try with

<img src="./assets/images/image-card.png" />


This Question was asked in StackOverflow by Richard77 and Answered by Sajeetharan It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?