Backbone.js route optional parameter

As of Backbone 0.9.9, you can add optional paramaters with parentheses.

For example in your routes object you can define an optional route part like this:

routes: {
    "organize(/:action)": "displayOrganize"
}

Now the url path will match /#organize and routes like /#organize/create.

Keep in mind that if you need routes like /#organize/ (with a trailing slash) to be recognized, you can do:

routes: {
    "organize(/)(:action)": "displayOrganize"
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)