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
Rather than having nothing come back, I would like to generate the key wrapped in braces. For example this context:
{ foo: 'foo' }
And this template:
<div>{{foo}}</div>
<div>{{bar}}</div>
Should render this output:
<div>foo</div>
<div>{{bar}}</div>
// or this...
<div>foo</div>
<div>[[bar]]</div>
// or this...
<div>foo</div>
<div>{{missing key - bar}}</div>
instead of this:
<div>foo</div>
<div></div>
The idea is to have a custom template that can be returned for keys that are missing from the given context rather than an empty string. This really helps me identify visually where certain keys in my context are missing, and which keys those are. Is this possible?
The text was updated successfully, but these errors were encountered:
Yep! Just override the helperMissing helper and you're good to go!
This is the default:
Handlebars.registerHelper('helperMissing',function(arg){if(arguments.length===2){returnundefined;}else{thrownewError("Could not find property '"+arg+"'");}});
Rather than having nothing come back, I would like to generate the key wrapped in braces. For example this context:
And this template:
Should render this output:
instead of this:
The idea is to have a custom template that can be returned for keys that are missing from the given context rather than an empty string. This really helps me identify visually where certain keys in my context are missing, and which keys those are. Is this possible?
The text was updated successfully, but these errors were encountered: