pagerjs
pagerjs copied to clipboard
skip-to-href
I've added a skip-to-href into my copy of pagerjs - it implements a redirect. I thought I'd mention it in case you wanted to include it:
//added by gb
ko.virtualElements.allowedBindings['skip-to-href'] = true
ko.bindingHandlers['skip-to-href'] = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var Cls = pager.useHTML5history ? pager.Href5 : pager.Href;
var href = new Cls(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
href.init();
window.location = href.path();
},
};
an example of usage from my app which redirects to the first item from a list if there is one:
<!-- ko if:value().length-->
<!-- ko 'skip-to-href':'../device/'+ value()[0].Id() +'/parameters/suiteTasks' -->
<!--/ko-->
<!-- /ko -->