You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to pass the helper implementation to the template e.g. here's some psuedo code
string source = @"Click here: {{link_to}}";
var template = Handlebars.Compile(source);
HandlebarsHelper link_to = "link_to", (writer, context, parameters) =>
{
writer.WriteSafeString($"<a href='{context["url"]}'>{context["text"]}</a>");
};
var data = new {
url = "https://github.com/rexm/handlebars.net",
text = "Handlebars.Net",
link_to = link_to
};
var helpers = new {
link_to = x)
};
var result = template(data);
The above outputs Click here: HandlebarsDotNet.HandlebarsHelper but I want it to recognise that 'link_to' is a helper.
I know it's possible to register the helper after the template is compiled but I want to be able scope the function to a single template render operation.
The text was updated successfully, but these errors were encountered:
Using this sample as a reference https://github.com/Handlebars-Net/Handlebars.Net#registering-helpers
I would like to pass the helper implementation to the template e.g. here's some psuedo code
The above outputs
Click here: HandlebarsDotNet.HandlebarsHelper
but I want it to recognise that 'link_to' is a helper.I know it's possible to register the helper after the template is compiled but I want to be able scope the function to a single template render operation.
The text was updated successfully, but these errors were encountered: