让我们让人类与猫与小猫
class Master
{
String masterName;
Cat[] cats;
}
class Cat
{
String catName;
Kitten[] kittens;
}
class Kitten
{
String kittenName;
}
现在我想在 html 中展示我所有的小猫和猫的主人。我用
<!-- 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 -->