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

Issue with accessing values outside Each #10

Open
bhupenderkeswani opened this issue Nov 9, 2022 · 2 comments
Open

Issue with accessing values outside Each #10

bhupenderkeswani opened this issue Nov 9, 2022 · 2 comments

Comments

@bhupenderkeswani
Copy link

If we use each for an array of objects and wants to access values outside that array of object, then this will throw an error, stating that the property is undefined. E,g, in my case I have the following object, which is causing an issue

{ valueToAccess: "test", arrayOfObjects: [ {name: "Tom", ...}, {name: "Jerry", ...}, ...] }

Taking the above example, we use the following code in the handlebar, but it will not let us access the value.
{{#each arrayOfObjects}} {{name}} is trying to access the value {{valueToAccess}}, which will return undefined instead of test. {{/each}}

@Nash54
Copy link

Nash54 commented May 23, 2023

I'm having the same issue, do you found a way to work around?

@tobnieder
Copy link
Contributor

This can be done in handlebars with {{#each arrayOfObjects}} {{../valueToAccess}} {{/each}} but that didn't wotk until #17
and is now fixed 🎉

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

No branches or pull requests

3 participants