Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip-to-href #178

Open
gilesbradshaw opened this issue May 21, 2014 · 0 comments
Open

skip-to-href #178

gilesbradshaw opened this issue May 21, 2014 · 0 comments

Comments

@gilesbradshaw
Copy link
Collaborator

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 -->


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant