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

Got a problem when using @first #1109

Closed
seajean opened this issue Sep 29, 2015 · 3 comments
Closed

Got a problem when using @first #1109

seajean opened this issue Sep 29, 2015 · 3 comments

Comments

@seajean
Copy link

seajean commented Sep 29, 2015

I have an object array like

 {
code: 111,
list:  {
  a:1,
  b:2
}}

and my template

{{#each list}}
{{#if @first}}
{{../code}}
{{/if}}
{{/each}}

the code output nothing

but if I delete

 {{#if  @first}}
{{/if}}

, it works fine.

@kpdecker
Copy link
Collaborator

What version of handlebars are you using? Can you create a fiddle demonstrating the failure?

@seajean
Copy link
Author

seajean commented Sep 30, 2015

I am using 3.0.0, fiddle demo is here : http://jsfiddle.net/seajean/63dmruL6/

@kpdecker
Copy link
Collaborator

You need to either use an additional ../ or update to Handlebars 4.0.
http://jsfiddle.net/63dmruL6/7/

The discussion is sort of lengthy, but we changed how ../ works under 4.0 to better match what your expectations are here #1028. That's the primary breaking change so you're likely safe to update.

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

2 participants