Skip to content

Instantly share code, notes, and snippets.

@tmamedbekov
Created June 23, 2017 19:56
Show Gist options
  • Save tmamedbekov/e10ec8f7cadc6c58eab154b587b649cc to your computer and use it in GitHub Desktop.
Save tmamedbekov/e10ec8f7cadc6c58eab154b587b649cc to your computer and use it in GitHub Desktop.
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