1

Images are kept in "assets" directory as its public but can it be kept in respective components so HTML files can easily access

2 Answers2

1

It is not required to put images in assets project.

Asset folder is preconfigured. When you run build command then all the things in asset folder will copied to output folder(dist) automatically for publish. So no need to copy manually.

You can also configured different folder as a asset. see in below code sample.

  "assets": [
    "assets",
    "xyz",
    "favicon.ico"
  ],
Dhaval kansagara
  • 551
  • 4
  • 17
0

Assets folder is used in angular for maintaining file which doesn't have to be modified while compiling. You can't maintain any files like Images, json or any other file types in a component folder(folders are only for development purpose only) because it will be not recognized while compiling.

If you are in any component always set image path like this. Always maintain assets as a starting folder

"assets/pic.img"

Not like this and it won't be recognized

"./../assets/pic.img"
Sheik Althaf
  • 1,595
  • 10
  • 16