Nested foreach binding

48 views
Skip to first unread message

sep.f...@gmail.com

unread,
Apr 18, 2013, 9:38:31 AM4/18/13
to knock...@googlegroups.com
Is it possible to have a foreach inside a foreach binding but the element on which you apply the nested foreach is not nested inside the element on which you apply the outer foreach? If it is possible, how do I do this?

Jeffrey Spies

unread,
Apr 18, 2013, 1:10:40 PM4/18/13
to knock...@googlegroups.com
I think an example is needed here: what is the input you have and the
output you want?

Just a point of clarification: nesting for loops are used when you
want to run the inner loop for every iteration of the outer loop. I
have a feeling you know this, and the issue is purely in my
misunderstanding your question.

Jeff.
> --
> You received this message because you are subscribed to the Google Groups
> "KnockoutJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to knockoutjs+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Michael Best

unread,
Apr 18, 2013, 4:54:54 PM4/18/13
to knock...@googlegroups.com, sep.f...@gmail.com
This is generally possible using the container-less syntax: <!--ko foreach: xxx-->...<!--/ko--> described here: http://knockoutjs.com/documentation/foreach-binding.html#note_4_using_foreach_without_a_container_element

-- Michael
Reply all
Reply to author
Forward
0 new messages