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();
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With