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

twice loop problem! #1

Closed
xcnbanba opened this issue May 9, 2012 · 2 comments
Closed

twice loop problem! #1

xcnbanba opened this issue May 9, 2012 · 2 comments

Comments

@xcnbanba
Copy link

xcnbanba commented May 9, 2012

var data={
list:[
{name:'guokai',show:true},
{name:'benben',show:false},
{name:'dier',show:true}
],
blah:[
{num:1},
{num:2,inner:[
{'time':'15:00'},
{'time':'16:00'}
]},
{num:3,inner:[
{'time':'15:00'},
{'time':'16:00'},
{'time':'16:00'}
]},
{num:4,inner:[
{'time':'15:00'},
{'time':'16:00'},
{'time':'16:00'}
]}
]
};
var tpl=[
'

    ',
    '{@each list as it,k}',
    '
  • ${it.name} (index: ${k})
  • ',
    '{@/each}',
    '{# first level attribute must specify the "data." prefix}',
    '{@each blah as it}',
    '
  • ',
    'num: ${it.num}
    ',
    '{@if it.num==3}',
    '{@each it.inner as it2}',
    '${it2.time}
    ',
    '{@/each}',
    '{@/if}',
    '
  • ',
    '{@/each}',
    '
'
].join('');

console.log(juicer(tpl,data));

output only three items limited by the max number of the second loop,but the first loop have full 4 items?why?

PaulGuo added a commit that referenced this issue May 9, 2012
@PaulGuo
Copy link
Owner

PaulGuo commented May 9, 2012

thanks very much, a serious problem that you mentioned in the issue #1 has been fixed in the last commit (99b278a).

@PaulGuo PaulGuo closed this as completed May 9, 2012
PaulGuo added a commit that referenced this issue May 9, 2012
PaulGuo added a commit that referenced this issue May 9, 2012
PaulGuo added a commit that referenced this issue May 9, 2012
@xcnbanba
Copy link
Author

:),haha,so quickly!!3Q

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