Skip to content Skip to sidebar Skip to footer

Can Not Properly Bind Observablearray Of Observables

I have the following code which should bind observableArray of observables.

Solution 1:

If you directly have ko.observable objects in your array you need to use $rawData instead of $data to bind directly to the observable objects themselves and not to their values:

<span data-bind="foreach: langs">
    <input data-bind="value: $rawData, valueUpdate: 'afterkeydown'"/>
</span>

Demo JSFiddle.

From the 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.

Post a Comment for "Can Not Properly Bind Observablearray Of Observables"