Handlebars.Net icon indicating copy to clipboard operation
Handlebars.Net copied to clipboard

Question: Is there a way to get the name of the property passed to a helper?

Open 206mph opened this issue 9 years ago • 1 comments

Given the following code: var data = new { myValue = "tEsT", otherValue= "tEsT" }; var template = "{{lowercase myValue}}";

Is there a way within a custom "lowercase" helper to the name of the property passed to the helper? In this case, I would want to get the name "myValue" from within the helper?

My goal is the be able to determine which fields are being used within the template so I know what data to provide the template for parsing.

206mph avatar Dec 13 '16 00:12 206mph

Since the property name is known in the template, {{helper propertyName "propertyName"}} would achieve what you're describing.

rexm avatar Dec 13 '16 01:12 rexm