Can not properly bind observableArray of observables

后端 未结 1 1640
臣服心动
臣服心动 2021-01-23 14:47

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




        
1条回答
  •  终归单人心
    2021-01-23 15:42

    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:

    
        
    
    

    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.

    0 讨论(0)
提交回复
热议问题