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
Hello!
I have a question that I am bringing here only because I couldn't find documentation or other references to this.
Is it possible to overwrite a nested data parameter for a partial ( {{> partial user.name='Laura'}})? Or is this something that requires a helper? Js Fiddle example
Code that fails to compile
var data = {
"user": {
"name": "Bob"
}
}
Handlebars.registerPartial("user_partial", "{{user.name}}");
// Overwrite the "user.name" parameter when rendering the partial
var template = Handlebars.compile(
"My name is {{> user_partial user[name]='Laura'}}" // throws compiler error
);
document.getElementById('output').innerHTML = template(data);
Desired output
My name is Laura
Thanks
The text was updated successfully, but these errors were encountered:
Hello!
I have a question that I am bringing here only because I couldn't find documentation or other references to this.
Is it possible to overwrite a nested data parameter for a partial (
{{> partial user.name='Laura'}}
)? Or is this something that requires a helper?Js Fiddle example
Code that fails to compile
var data = { "user": { "name": "Bob" } } Handlebars.registerPartial("user_partial", "{{user.name}}"); // Overwrite the "user.name" parameter when rendering the partial var template = Handlebars.compile( "My name is {{> user_partial user[name]='Laura'}}" // throws compiler error ); document.getElementById('output').innerHTML = template(data);
Desired output
Thanks
The text was updated successfully, but these errors were encountered: