knockout, nested foreach

Viewed 20205

Let's I have Humans with Cats with Kittens

class Master
{  
   String masterName;

   Cat[] cats;  
}
class Cat 
{
   String catName;

   Kitten[] kittens;
}

class Kitten 
{
   String kittenName;
}  

Now I want show all my Kittens with Cats with Masters in html. I use

                    <!-- ko foreach: humans -->
                    <!-- ko foreach: cats -->
                    <!-- ko foreach: kittens -->
<p data-bind="$data.kittenName"></p>
<p data-bind="$parent.catName"></p>
<p data-bind="???????"></p>   <!-- How get master's name? -->
                    <!-- /ko -->
                    <!-- /ko -->
                    <!-- /ko -->
2 Answers
Related