How to show image in Blazor view

blazor

Question

I am trying show images in a Blazor view, but it's not working and shows only an image icon:

<img src="~/Images/watch.jpg" asp-append-version="true" width="300px" />

Here my image resides in this path wwwroot/Images/watch.jpg

Popular Answer

You are probably running into this bug: https://github.com/aspnet/Blazor/issues/1216 and need to remove the ~ to make it work, or wait for the 0.6 release.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why