5

i have a quite simple backbone router and everything works fine so far. Except when i reload/direct enter the url i.e. http://mydomain.com/#list/50fadc41125b0 I've tried nearly everything now without any positiv results at all.

myRouter = Backbone.Router.extend({
    routes: {
        "list/:id": "getList",      
        "*actions": "defaultRoute" // not needed right now
    },
    getList: function (id) {
        console.log ("test");
    }
});

i tried it this way as well without any difference

// init router
router = new myRouter;
router.on('route:getList', function (id) {
    [...]
});

i have no i idea how to make this work! hopefully someone has an answer for me!

EDIT:

i also start the history

Backbone.history.start();
Horst
  • 407
  • 5
  • 17

1 Answers1

3

due a mistake i was initializing my router asynchronous in a fetch success statement so Backbone.history.start() had nothing to initialize.

thx to the user Lukas for reminding me to create the router before.

Horst
  • 407
  • 5
  • 17