Title: Knockout.js and Sammy.js wrong behaviour
Tags: javascript;knockout.js;sammy.js
Question: I'm developing admin panel to my website and decided to do it with knockout and sammy. But I am faced with a routing problem. I have two pages:
http://localhost/admin/element and http://localhost/admin/category.
On my element page I have the following Sammy config:
Sammy(function() {
this.get('#:currentpage', function() {
self.reloadPage(this.params.currentpage);
});
this.get('', function() {
this.app.runRoute('get', '#1');
});
}).run();
Everything works perfect but if I try to go to another page (by usual link, e.g. Edit Categories) I just get to the empty route on the same page, so I just cannot go to another page with link. Any ideas how to fix that?

Here is the accepted answer: Don't use '' in your Sammy configuration. Try '/' for root page or '/admin/element' for your elements instead.
var Router = function() {
var sammy = new Sammy.Application(function() {
this.get('#:currentpage', function(context) {
alert(context.params.currentpage);
});
this.get('/admin/element', function () {
this.app.runRoute('get', '#1');
});
}),
run = function() {
sammy.run();
};
return {
run: run
};
$(function() {
var r = new Router();
r.run();
PS: The example uses version of Sammy 0.7.1. In version 0.6.3 there is another behavior.
Comment for this answer: Thanks, this simple suggestion helped me a lot:)

Here is another answer: This works if you have an action link and want to click through to another page
`<li&gt;@Html.ActionLink("Admin Action Link Test", "Admin", "Home")</li&gt;
this.get('/Home/Admin', function ()
{
location.assign("/Home/Admin");
});`
or you can do this using the hash
<li&gt;<a href="#/Home/About"&gt;About Full Path</a&gt;</li&gt;
this.get('#/Home/About', function ()
{
location.assign("/Home/About");
});

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:12/20/12', 'FavoriteCount': 0.0, 'PostTypeId': 1, 'Tags': '<javascript><knockout.js><sammy.js>', 'Title': 'Knockout.js and Sammy.js wrong behaviour', 'ViewCount': 957, 'id': 13971253, 'user_AboutMe': '', 'user_AccountId': 1046785.0, 'user_DisplayName': 'Eugene', 'user_Reputation': 1505.0, 'user_Views': 94.0, 'user_id': 1051604.0}}