Problems getting started

Skip to first unread message

Denny Dombkowski

Jul 23, 2013, 6:43:00 PM7/23/13
This is my very simple code to try to get started:

 var app = Sammy('#main', function () {
     this.get('#/dorouteswork', function () {
     this.get('#/', function () {

function yestheydo() {
    alert('Yes they do!')

A lot was essentially copied from the website.

When I open the page, I get a "loaded!" alert, which means an initial route successfully loads.  However, when I follow my home page with /dorouteswork, or {page}/#dorouteswork, or {page}/#/dorouteswork), I get a 404 error.  What am I missing?

Mike Aguilar

Jul 23, 2013, 6:54:55 PM7/23/13
Does resolve to anyting?

Denny Dombkowski

Jul 24, 2013, 10:39:40 AM7/24/13
It seems to resolve to the base route.  AKA, I get a "loaded!"  alert, but not a "Yes they do!" alert.

I should mention that this site is on IIS.  It's intended to eventually make AJAX requests to an API controller.  The site is in my hosts file.  Is there any configuration I have to do in IIS to make the routing work?

Joshua Austill

May 11, 2016, 9:17:04 PM5/11/16
to Sammy.js
I'm having a very similar issue, also on IIS.  Here's my code

Enter code here... var app = Sammy('#page', function () {

        this.get(/\#\/(.*)/, function(context) {
            console.log("hash route called");
            $(".navbar-nav .dropdown").removeClass("open");
            var url = $$.getUrlFromHash(context.path, "/", "/");
                .then(function() {
                    console.log("callback after partial hit");
                    ko.applyBindings(appVM, context.$element()[0]);

My initial route loads, the first link I click loads, then links just don't do anything.  It's like Sammy crashes or something, because it still stops the default action, it just doesn't match any routes, after the first one...

I've been working on this for DAYS, and I'm so frustrated I could scream :(
Reply all
Reply to author
0 new messages