backbone routing parameter passing (optional)

Because maintaining the company's old projects and access to the backbone. Previously only heard his name, no its code.

Because other items need to jump to a page of the project, but the UI needs to change.

Method to consider is the route to add an optional parameter. code show as below:

Normal route:

1 routes : {
2                 "" : "indexAction",
3                 "index" : "indexAction",
4                 "resource" : "resourceAction",
5                 "mine" : "mineAction",
6             },

Parameter passing route:

1 routes : {
2                 "growup/:showFlag" : "growupAction",
3                 "serviceDetail/:meId" : "serviceDetailAction",
4                 "mine/:type" : "mineAction",
5                 "question/:index/:content" : "questionAction",
6             },

Optional parameters passed route:

routes : {
                "live/:id/:meId/:type(/:from)" : "liveAction",
                "module3(/:name)(/:age)" :  "moduleContent"
            },

Encounter a little bit to see it, or see more of the mainstream framework of cost-effective.

Guess you like

Origin www.cnblogs.com/xguoz/p/11649622.html