0

I'm working with trigger and backbone, and am trying to programmatically navigate to a url. This is all happening using the file:// protocol, as everything in running inside trigger io only.

This manual navigate though doesn't trigger the function associated with the route.

My router looks like this

var BARouter = Backbone.Router.extend({
    routes: {
        "users/sign_in": "userSignin",
        "users/sign_up": "userSignup",
        "": "catchAll"
    },

    userSignin: function(){

    },
    userSignup: function(){
        forge.logging.info("in user signup----");
    },
    catchAll: function(){

    }
});


var app_router = new BARouter();
BA.router = app_router;
Backbone.history.start({pushState: true});

and I'm manually navigating

BA.router.navigate(navigate_to("users/sign_up"), {trigger:true});

The navigate_to method just returns the full url in the form "file://users/sign_up".

But nothing is logged to the console, and the execution flows normally. Am I missing something here ?

hashpipe
  • 305
  • 3
  • 16

1 Answers1

2

Using pushState with file urls probably doesn't make sense, I'm also not sure why you need the navigate_to function.

Try setting pushState to false and navigate using the string of the route, i.e.:

BA.router.navigate("users/sign_up", {trigger:true});
Connorhd
  • 2,476
  • 14
  • 15
  • My bad. The pushState actually works fine. My problem was generating the full url. I was doing it just for clarity, but somehow it was not working. – hashpipe Nov 19 '12 at 09:27