Thankfully, I found this unit test code. Here's what I learned:
- You must have a
<base href="..."/>
to specify your base URL. - You should not include the raw
history.js
file that's in Git, but use thejquery.history.js
bundle. - Instead of using
pager.start()
, usepager.startHistoryJs()
.
Here's my updated init code:
define(['knockout', 'pager', 'history'], function (ko, pager, history) {
var viewModel = /* [Create my view model] */;
pager.useHTML5history = true;
pager.Href5.history = history;
pager.extendWithPage(viewModel);
ko.applyBindings(viewModel);
pager.startHistoryJs();
});
And here's how I AMD-ized jquery.history.js
:
define(['jquery'], function () {
// [Original code]
return History;
});