mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Rename packages. Bump versions to -alpha6
This commit is contained in:
25
Microsoft.AspNet.AngularServices/AngularRenderer.cs
Normal file
25
Microsoft.AspNet.AngularServices/AngularRenderer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.NodeServices;
|
||||
|
||||
namespace Microsoft.AspNet.AngularServices
|
||||
{
|
||||
public static class AngularRenderer
|
||||
{
|
||||
private static StringAsTempFile nodeScript;
|
||||
|
||||
static AngularRenderer() {
|
||||
// Consider populating this lazily
|
||||
var script = EmbeddedResourceReader.Read(typeof (AngularRenderer), "/Content/Node/angular-rendering.js");
|
||||
nodeScript = new StringAsTempFile(script); // Will be cleaned up on process exit
|
||||
}
|
||||
|
||||
public static async Task<string> RenderToString(INodeServices nodeServices, string componentModuleName, string componentExportName, string componentTagName, string requestUrl) {
|
||||
return await nodeServices.InvokeExport<string>(nodeScript.FileName, "renderToString", new {
|
||||
moduleName = componentModuleName,
|
||||
exportName = componentExportName,
|
||||
tagName = componentTagName,
|
||||
requestUrl = requestUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user