pandell / Spagety

Other
0 stars 0 forks source link

'with'-like parameter #2

Open cjasinsk opened 10 years ago

cjasinsk commented 10 years ago

Create a with parameter to pass into the page data-binding, so that the viewModel can be changed as needed. However, unlike the default with binding provided by knockout, this should not remove all elements, and create a new bindingContext.

Each page has a viewModelContainer observable, that the bindingContext is bound against. By changing the viewModel in the viewModelContainer should hopefully update the bindingContext.

Need to also check against $data $index $parent etc, to make sure those still work as well.

The purpose of this is to allow a parent page that has an array of items, and to display a child page with the selected item.

This discusses making an observable bindingContext (such as viewModelContainer). http://stackoverflow.com/questions/9854512/knockoutjs-rebinding-viewmodel#answers

This may also be helpful: https://github.com/mbest/knockout-repeat