First, thanks for creating a really nice library!
It would be nice to have access to the Page object when dynamically fetching viewmodels in "withOnShow". I modified the source for withOnShow to pass "this", just like you are currently doing for sourceOnShow:
I replaced
572 - }, this));
572 + }, this), this);
This allow me to retrieve specific data for my views based on the route, eg
http://domain.name.com/order/56
<div data-bind="page: {id: '?', withOnShow: MyNamespace.Order.GetModel()}"></div>
MyNamespace.Order = {
GetModel: function () {
return function (callback, page) {
$.getJSON('/api/orders/' + page.currentId, function (data) {
var viewModel = new MyNamespace.Order.ViewModel(data);
callback(viewModel);
});
};
}
};
Off course, ability to use wildcards would be even better, to say something like:
<div data-bind="page: {id: '?', withOnShow: MyNamespace.Order.GetModel({1})}"></div>
But I don't think this is an easy addition? However, I hope you will consider adding the page parameter as described above.
First, thanks for creating a really nice library!
It would be nice to have access to the Page object when dynamically fetching viewmodels in "withOnShow". I modified the source for withOnShow to pass "this", just like you are currently doing for sourceOnShow:
I replaced
572 - }, this));
572 + }, this), this);
This allow me to retrieve specific data for my views based on the route, eg
http://domain.name.com/order/56
Off course, ability to use wildcards would be even better, to say something like:
But I don't think this is an easy addition? However, I hope you will consider adding the page parameter as described above.