Skip to content

Instantly share code, notes, and snippets.

@AndersDJohnson
Last active June 5, 2019 13:34
Show Gist options
  • Select an option

  • Save AndersDJohnson/4406261 to your computer and use it in GitHub Desktop.

Select an option

Save AndersDJohnson/4406261 to your computer and use it in GitHub Desktop.
Handlebars.js partial parent context access I wrote. See https://github.com/wycats/handlebars.js/issues/182#issuecomment-4445747
/**
* Handlebars.js partial parent context access I wrote.
* See https://github.com/wycats/handlebars.js/issues/182#issuecomment-4445747
*/
Handlebars.registerHelper('$', function ( child, options ) {
if ( typeof child !== 'object' ) {
return '';
}
child['$_'] = this;
return options.fn( child );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment