Minja
Minja

Reputation: 1222

PagerJs - page-href add undefined in href path

I'm using knockout in my asp .net mvc application and now i want to setup pagerjs. Following instructions, I have added this part of html for my navigation menu in main layout

<ul class="nav" data-bind="foreach: $__page__.children">
                    <li>
                        <a  data-bind="page-href: $data">
                    </li>              
 </ul>

and I have this in my partial view:

<div data-bind="page: {id: 'start', title: 'My Applications', alt:'My applications'>...</div>
<div data-bind="page: {id: 'statistics', title: 'My statistics', alt:'My statistics'>...</div>

However when it render html I got following results:

<a  data-bind="page-href: $data"  href="undefinedstart">
<a  data-bind="page-href: $data"  href="undefinedstatistics">

and my start div is not visible.

I cannot understand why this undefined is shown? Any help?

Thanks

Upvotes: 3

Views: 566

Answers (1)

Minja
Minja

Reputation: 1222

I forgot to add

 <base href="absolute-URI-to-index.html/"/>

at the top of my DOM. I found it looking into the pagerjs code. However I switched to jquery.haschange to avoid adding base tag to my html.

BR,

Minja

Upvotes: 3

Related Questions