Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escaping @ in Blazor

I want to display image from icon library in Blazor component.

The path is:

wwwroot/lib/@icon/open-iconic/icons/account-login.svg

But @ is a special character in Blazor.

like image 751
michael melena Avatar asked Nov 26 '19 15:11

michael melena


2 Answers

Quoting Razor syntax:

To escape an @ symbol in Razor markup, use a second @ symbol:

<p>@@Username</p>

The code is rendered in HTML with a single @ symbol:

<p>@Username</p>

like image 162
dani herrera Avatar answered Oct 19 '22 14:10

dani herrera


Just add another @ symbol. So your exmaple:

wwwroot/lib/@@icon/open-iconic/icons/account-login.svg

will render as:

wwwroot/lib/@icon/open-iconic/icons/account-login.svg

like image 38
Gerrit Avatar answered Oct 19 '22 12:10

Gerrit