I use Backbone.Blazer plugin for my app routing. But i can't pass route parameters to the Route constructor. How can it be done?
var AppRouter = Backbone.Blazer.Router.extend({
routes: {
'': new HomeRoute(),
'accounts/:id': new AccRoute(), //how pass id parameter to the AccRoute constructor?
'login': new LoginRoute()
}})
You don't pass route arguments to the constructor.
The route argument are passed to the execute function of the Route object.
var AccRoute = Backbone.Blazer.Route.extend({
execute: function(routeParams) {
console.log(routeParams.params[0]);
}
});