2012-10-05 2 views
1

내 Handlebars JS 템플릿으로 인해 실망한 오류가 발생했습니다. 핸들 모음 JS를 중첩하는 방법은 무엇입니까?

{{if showSingle}} 
    {{#with single}} 
     {{> postSingle}} 
    {{/with}} 
{{else}} 
    {{#each posts}} 
     {{> postItem}} 
    {{/each}} 
{{/if}} 

이 불가능처럼 중첩되어 문제

Error: Parse error on line 9: 
...  {{/each}} {{/if}} 
----------------------^ 
Expecting 'EOF' 

핸들 바?

{{#each posts}} 
    {{> postItem}} 
{{/each}} 

답변

2

if에서 # 누락 :

{{#if showSingle}} 
    {{#with single}} 
     {{> postSingle}} 
    {{/with}} 
{{else}} 
    {{#each posts}} 
     {{> postItem}} 
    {{/each}} 
{{/if}} 

그냥이 잘 작동하고, 상황에 물건을 넣어
관련 문제