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.
Create a
with
parameter to pass into thepage
data-binding, so that the viewModel can be changed as needed. However, unlike the defaultwith
binding provided by knockout, this should not remove all elements, and create a new bindingContext.Each page has a
viewModelContainer
observable, that thebindingContext
is bound against. By changing the viewModel in theviewModelContainer
should hopefully update thebindingContext
.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#answersThis may also be helpful: https://github.com/mbest/knockout-repeat