I want to pass pairs of key values ββas parameters for trunk routes and I want them to deserialize to a javascript object before calling the displayed function.
var MyRouter = Backbone.Router.extend({ routes: { "dashboard?:params" : "show_dashboard" }, show_dashboard: function(params){ console.log(params); } });
When I switch to "http: //...#dashboard? Key1 = val1 & key2 = val2", then {console1: "val1", key2: "val2"} should be printed to the console.
Currently, the jQuery BBQ $ .deparam method is used inside each function displayed to access a deserialized object. It would be nice if I could extend the Router and define it only once, so that the parameters are available in all displayed functions as an object. What would be a clean way to do this? And are there any pitfalls in this?
Many thanks,
mano
Manokaran k
source share