0

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()
      }})
betmakh
  • 435
  • 4
  • 8

1 Answers1

1

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]);
    }
});
Jacob
  • 1,763
  • 2
  • 11
  • 13