I'm just getting started with knockout.js. I have a foreach
binding like this, which works fine:
<ul data-bind="foreach: people">
<li> .... </li>
</ul>
people
is part of my model that I pass to ko.applyBindings
. According to the documentation, the following should work too:
<ul data-bind="foreach: {data: people}">
But it does not. The list remains empty, but I don't see any error in the error window of my browser. Any hint what I might be doing wrong? Is there some subtle difference between both calls which I don't see?
My idea is to pass handlers for afterAdd
to foreach
. Therefore I need the second way to call it.