Rnue
Rnue

Reputation: 105

knockout foreach is not working for objects in Array

I have an array that has a list of objects and I am trying to loop through it but it seems to not working.

<!-- ko foreach: applicationsAndProducts -->
                    <p>Apps and Products</p>
                    <ul>
                        <li data-bind="text: applicationsAndProducts.Product"></li>
                    </ul>
                    <!-- /ko -->

applicationsAndProducts has 3 values as below

enter image description here

Upvotes: 0

Views: 35

Answers (1)

sebasaenz
sebasaenz

Reputation: 1966

You should only be using Product instead of applicationsAndProducts.Product. Check the documentation for foreach binding

<!-- ko foreach: applicationsAndProducts -->
    <p>Apps and Products</p>
    <ul>
        <li data-bind="text: Product">
        </li>
    </ul>
<!-- /ko -->

Upvotes: 0

Related Questions