1

I've got nested arrays in my config JSON:

Each Step node contains own products array.

enter image description here

Foreach binding in a template for steps array works fine (the title value is displayed). However, I can't list products array within single step node.

Here is my code:

<div id="configurator-wrapper" data-bind="scope: 'drago-configurator'">
    <ul data-bind="foreach: steps">
       <li data-bind="text: title">
            <ul data-bind="foreach: products">
                <li data-bind="text: name"></li>
            </ul>
       </li>
    </ul>
</div>
2

Your text binding is overwriting the nested UL, so you'll want to use a separate element. Something like this should work:

<div id="configurator-wrapper" data-bind="scope: 'drago-configurator'">
    <ul data-bind="foreach: steps">
       <li>
            <span data-bind="text: title"></span>
            <ul data-bind="foreach: products">
                <li data-bind="text: name"></li>
            </ul>
       </li>
    </ul>
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.