Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Web;
using System.Web.Mvc;
using Sitecore.Mvc.Extensions;
namespace sitecore.local.Controllers
{
public static class Angular
{
public static IHtmlString RawJsEncodedString<T>(this HtmlHelper<T> htmlHelper, HtmlString str)
{
var test = str.ToString();
if (test.IsEmptyOrNull())
{
return new HtmlString(string.Empty);
}
return new HtmlString(HttpUtility.JavaScriptStringEncode(test));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment