Here is a jsFiddle demonstrating the following problem:
Given a foreach binding over a list of (observable) strings, the observables do not seem to update from changes t
I worked around this by using value: $parent.list[$index()]
, as seen in this jsFiddle. The new bindings looks like this:
-
One could perhaps improve on this with a custom binding.
See also this related GitHub issue #708 for Knockout.js.
Update for Knockout 3.0:
Knockout now provides $rawData
:
creates a two-way binding as expected.
From the Binding Context documentation:
$rawData
This is the raw view model value in the current context. Usually this will be the same as $data, but if the view model provided to Knockout is wrapped in an observable, $data will be the unwrapped view model, and $rawData will be the observable itself.