Reputation: 131
I'm trying to make a Slideshow for my WebApp with Angular 2. The problem is, when I try to display an image I get a 404-Error. Error-Message
The picture is in the same folder as my html-file.
<img *ngIf="i == activeIndex" src="try1.png" style="width:100%; height: 500px">
PS: The *ngIf isn't the problem it perfectly works with an internet source.
Upvotes: 0
Views: 2626
Reputation: 22723
Simply keep your images in assets folder and use path as
src="/assets/try1.png"
Hope it will help you
Upvotes: 1
Reputation: 15442
try to add it to your .angular-cli.json
file under assets
section:
"assets": [
"assets",
"favicon.ico",
"try1.png"
]
and make sure your image file is located in src/
directory
Upvotes: 0