So far, i don't think ViewComponent
solves that neither does TagHelper
. Is there any replacement to this? Something that takes parameters and returns a HtmlString
?
I don't see anything harmful with:
@helper foo(string something) {
<div>Say @something</div>
}
var emailbody = classfilenameinAppCodefolder.foo("hello"); //store result in a variable for further processes
For now i believe its a temporary delete before RC. https://github.com/aspnet/Razor/issues/281 and https://github.com/aspnet/Mvc/issues/1130 Well! it better be. I hope someone is working on it. Without @helper
, building large HtmlString
or 'template' would be a serious pain.
Note: Partial View doesn't seem to do the trick. I think it only renders views not return view to variable.
Secondly, what happened to the App_Code folder?
@{
Func<String, IHtmlContent> foo = @<div>Say @item</div>;
}