Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

accessing router initialize parameters from the route callback? #49

Description

@newtonianb

I saw you can pass parameters to your subroute like so

var mySubRouteInstance = new BooksRouter("books", {locale: "en_US", isVIP: true));

Then retrieve it from the SubRoute like so

initialize: function(options) {
    this.locale = options.locale;
    this.isVIP = options.isVIP;
}

Now given my subroute, how can I access locale and isVIP from my subroute callback mycallback()?

var BooksRouter = Backbone.SubRoute.extend({
    initialize: function(options) {
         this.locale = options.locale;
    }
    routes: {
        "myroute"   : "mycallback",
    },
    mycallback: function() {
         //###### how can I get the value of locale here??
    },
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions