简体   繁体   中英

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

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

Try with

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM