I am passing following string from MVC component (c#) to razor view;
var Count = "99+";
When I try to access this in razor view, i get &@x2B appended to it;
console.log(@Model.Count);
///
///--output
99+
Razor does some encoding. To get ride of this problem, we need to use @Html.Raw.
console.log(@Html.Raw(Model.Count)
///
///--output
99+
or better, use it with backtick operator;
let count = `@Html.Raw(Model.Count)`;
console.log(count);
///
///--output
99+
enjoy!
Add to favorites