Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find right context when use #each in #each #1761

Open
ubourdon opened this issue Jun 28, 2021 · 1 comment
Open

Can't find right context when use #each in #each #1761

ubourdon opened this issue Jun 28, 2021 · 1 comment

Comments

@wadouk
Copy link

wadouk commented Jun 28, 2021

Workaround

Handlebars.registerHelper("foreach", function(context, options) {
    return context.map((item, i) => {
        let newOptions = {
            data: context,
            blockParams: [context[i], i]
        }
        return options.fn({...context[i], ...options.data.root}, newOptions)
    })
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants