I have a route set up like this:
var AppRouter = Backbone.Router.extend({
routes: {
"items": "getItems", // matches http://example.com/#anything-here
"/*": "showAll",
"edit/:id" : "editItem",
"save/:id" : "saveItem",
"delete/:id" : "deleteItem"
}
});
// Initiate the router
var app_router = new AppRouter;
app_router.on('route:getItems', function() {
});
app_router.on('route:showAll', function(){
console.log("SHOWALL");
skillsview.render();
});
app_router.on('route:editItem', function(id){
console.log("EDIT SKILL: "+id);
editview.render(id);
});
app_router.on('route:saveItem', function(id){
console.log("SAVED SKILL");
skillsview.render(id);
});
app_router.on('route:deleteItem', function(id){
console.log("DELETED SKILL");
skillsview.render(id);
});
However, I am getting a front end JS error when I try to send the id variable into my render function. The render function does not want to take any parameters I think. But if this is true, how can I send my router parameters to my render function where I fetch a Model using the id given from the router?