Use with:
to change the binding context - similar to the standard KnockoutJS with
binding.
One important difference is that you shouldn't use an observable model (see workaround). The current version (2.2) of KnockoutJS
does not support changing the binding context (which pager.js does) while binding to an observable model.
Hopefully this will be solved in KnockoutJS 2.3.
<div data-bind="page: {id: 'user', 'with': user}"> <span data-bind="text: name"></span> </div> <script type="text/javascript"> viewModel = { user:{ name:ko.observable("Amy") } }; </script>
A workaround if you got an observable model is to write
<div data-bind="page: {id: 'user'}"> <!-- ko with: user --> <span data-bind="text: name"></span> <!-- /ko --> </div> <script type="text/javascript"> viewModel = { user:ko.observable({ name:ko.observable("Amy") }) }; </script>