Skip to content

Ad-Hoc Template Rendering #531

Open
Open
@OpenSpacesAndPlaces

Description

@OpenSpacesAndPlaces

How would I use this to just render templates with?

We're building an MVC site.
We'd like to streamline to use one template format. (rather than needing to know Razor, Angular, others)

Trying to look a feasibility of doing this with angular, but we don't need a entire angular app to run - we just want to be able to ad-hoc specify a template path and a data object - that's it.

In Razor I can do something like:

var viewResult = _razorViewEngine.GetView("~", viewPath, false);
....
var viewContext = new ViewContext(
					actionContext,
					viewResult.View,
					viewDictionary,
					new TempDataDictionary(actionContext.HttpContext, _tempDataProvider),
					sw,
					new HtmlHelperOptions()
				);
await viewResult.View.RenderAsync(viewContext);
...

Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions