Topic: Images not loading from assets folder in Angular
path:
Damian Gemza
staff answered 2 years ago
Dear @mani12
You're using the wrong path to the images.
In the Angular project, you don't have to add the relative path from your file to image file.
Angular resolves this problem for you, and in a component, you have to only add a path to the assets folder, instead of ../../assets.
This code will work:
<img src="assets/img.jpg" alt="">
and this code will not work:
<img src="../../assets/img.jpg" alt="">
Best Regards,
Damian
mani12 commented 2 years ago
Hi,
I have used this code >
<img src="assets/img.jpg" alt="">
still not able to get images from the assets folder.
Damian Gemza
staff answered 2 years ago
Dear mani12,
Do you have img.jpg file in the src/assets folder? It's necessary to put there an image file.
Please take a look at this StackOverflow question.
Best Regards,
Damian
Answered
- User: Free
- Premium support: No
- Technology: Angular
- MDB Version: 6.2.3
- Device: PC
- Browser: chrome
- OS: windows
- Provided sample code: No
- Provided link: No