1

Am I using the wrong path to load in an image that I downloaded? I am trying to load frank.jpg from about-user.component.html. enter image description here

Why am I getting a 404 not found error for the resource?

FrankTheTank
  • 765
  • 2
  • 12
  • 30

2 Answers2

1

You use the assets array in .angular-cli.json to list files or folders you want to copy as-is when building your project.

By default, the src/assets/ folder and src/favicon.ico are copied over.

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

make one image folder in assets

put your image in that folder

then in angular-cli.json

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

images is folder name then give path like ../assets/images/frank.png in src

Nihal
  • 5,262
  • 7
  • 23
  • 41
1

Any image you use need to be put in the assets folder. You can then access the images from there.

Check this link on how to access images from assets folder.

Arjun Panicker
  • 730
  • 1
  • 8
  • 20