1

I am working on an angular project but trying to add an image to a table row in the html component . The image is not showing and I have tried many ways to make it work but still can't get it to show . Here is the home.component.html code :

The Images are in a folder named "images" in the project folder under the e2e folder , atop the node_modules folder


<table>
<tr>
<td>
<img src="images/Larissa.jpg" alt="investor1">
<p>"Trusted and quick profit. I use this website many times and I recommend it."</p>
</td>
<td>
    <img src="images/petroski.jpg" alt="investor2">

    <p>"I feel safe with the knowledge that my  investment is secured and safe with Coin Rush."</p>
</td>
<td>
<img src="images/marie.jpg" alt="investor3">
<p>"Thank you i am very impressed”</p></td>
</tr>
</table>

wizdemonizer
  • 115
  • 4
  • 15

3 Answers3

1

Images are loaded from those folders which are set static or we can say assets folder. If you want to load specific resource, then you must put that resource under assets.

"assets": [
  "src/assets"
 ],

If you want to create new folder, then provide that folder path under assets in angular.json.

And provide relative path starting with your folder. For example,

Your image is under the path src/assets/images/1.jpg

Then you need to provide path as

<img src="assets/images/1.jpg">
Vikas Keskar
  • 1,158
  • 9
  • 17
0

e2e folder is not a public folder. It will be used by e2e testing. You can google it by End to end testing (E2E). https://coryrylan.com/blog/introduction-to-e2e-testing-with-the-angular-cli-and-protractor

R0b1n
  • 513
  • 1
  • 5
  • 28
0

You have to add a directory named assets and inside this directory you can store all the images required in your project, to use those images you have to provide relative path of images in the src attribute of the image tag