I have got a very simple route definition but somehow "subroutes" does not work. Assuming I have got this index.html file:
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Ffirst" data-navigo>First</a>
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fsecond" data-navigo>Second</a>
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fthird" data-navigo>Theard</a>
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2FOffer%2Ftest" data-navigo>Test1</a>
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2FOffer%2Ftest2" data-navigo>Test2</a>
<div id="view"></div>
<script src="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fjs%2Fnavigo.js"></script>
<script src="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fscripts.js"></script>
and my scripts.js looks like this:
router = new Navigo("http://localhost/");
router.on({
'/Offer/test': function (params) {
$id('view').innerHTML = 'offer test';
},
'/:action': function (params) {
$id('view').innerHTML = params.action + ".html" ;
},
'/Offer/:action': function (params) {
$id('view').innerHTML = 'offer '+ params.action + ".html" ;
}
});
So when I load the page in the browser everything is fine. Then I click on the first link and the browser displays "first.html" which is also correct. After that I click on Test1 and the location of the url changes to "http://localhost/Offer/test", everything is fine. But now, when I click again on "First" the url changes to "http://localhost/Offer/first".
I tried to remove the "/" in the a tags as well as in the route configuration. Also i tested the same procedure without providing a root url. Same behavior.
Any idea how I can solve this problem?
I have got a very simple route definition but somehow "subroutes" does not work. Assuming I have got this index.html file:
<a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Ffirst" data-navigo>First</a><a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fsecond" data-navigo>Second</a><a href="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fthird" data-navigo>Theard</a><a href="/sitelet?url=https%3A%2F%2Fgithub.com%2FOffer%2Ftest" data-navigo>Test1</a><a href="/sitelet?url=https%3A%2F%2Fgithub.com%2FOffer%2Ftest2" data-navigo>Test2</a><div id="view"></div><script src="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fjs%2Fnavigo.js"></script><script src="/sitelet?url=https%3A%2F%2Fgithub.com%2Fkrasimir%2Fnavigo%2Fissues%2Fscripts.js"></script>and my scripts.js looks like this:
router = new Navigo("http://localhost/");router.on({'/Offer/test': function (params) {$id('view').innerHTML = 'offer test';},'/:action': function (params) {$id('view').innerHTML = params.action + ".html" ;},'/Offer/:action': function (params) {$id('view').innerHTML = 'offer '+ params.action + ".html" ;}});So when I load the page in the browser everything is fine. Then I click on the first link and the browser displays "first.html" which is also correct. After that I click on Test1 and the location of the url changes to "http://localhost/Offer/test", everything is fine. But now, when I click again on "First" the url changes to "http://localhost/Offer/first".
I tried to remove the "/" in the a tags as well as in the route configuration. Also i tested the same procedure without providing a root url. Same behavior.
Any idea how I can solve this problem?