Looking to include an argument while routing within a Backbone.js application
Below is the script:
var AppRouter = Backbone.Router.extend({
routes: {
'toolSettings/(:action)' : 'toolSettings'
}
});
var initialize = function() {
var app_router = new AppRouter;
app_router.on('route:toolSettings', function(actions) {
toolSettingsRoute.route();
});
Backbone.history.start();
};
There is a
<a href="toolSettings/target" />
link on the UI that triggers the toolSettingsRoute.route()
function.
The goal is to pass the action
argument in the route method and use it for subsequent actions.
Attempted toolSettingsRoute.route(action)
without errors, but unsure how to utilize this argument in the toolSettingsRoute.js file.
Seeking guidance on the correct way to pass and utilize arguments in JavaScript functions.