Last active
June 5, 2019 13:34
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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