Adrian
Adrian

Reputation: 87

Cannot find correct path to image in Angular - Node app

I am having trouble displaying an image which is in my angular folder app. here is my folder structure: enter image description here

I am accessing it from the contact.component folder; I have tried accessing directly like src="../images/DNS.jpg" and relatively to the index.html file src="./app/images/DNS.jpg" and it doesn't work. How can I reference this?

Upvotes: 0

Views: 309

Answers (1)

Pardeep Jain
Pardeep Jain

Reputation: 86790

Put all your images in assets folder and Try this :

<img src="assets/DNS.jpg" />

As, angular recommends to put all your resources in the assets folder including images/fonts etc and access from there.

Upvotes: 2

Related Questions