<!-- ko foreach: foos -->
<div>
<div data-bind="text: name">
...
<nav with: $root>
<ul data-bind="foreach: foos">
<!--
I want <li> to have class="active" if the "parent" name is the same as name in this context
So something like
if $parents[1].name = name
-->
<li>
<a href="#" data-bind="text: name"></a>
</li>
</ul>
</nav>
...
</div>
<!-- /ko -->
有办法吗?我是否使用 KO 的if关键字?还是我只是想错了?