Multiple routers with backbone.js -



Multiple routers with backbone.js -

can utilize multiple routers in backbone.js, don't interfere each other route-wise, without issues? or there should concerned about?

code sample:

myapp.routers.main = backbone.router.extend({ routes : { "": "index" }, index : function() { console.log("routed main router");} }); myapp.routers.another = backbone.router.extend({ routes : { "notmain": "index" }, index : function() { console.log("routed router");} }); mainrouter = new vaikava.routers.main; notmainrouter = new vaikava.routers.another; backbone.history.start();

yes, works fine; time you'd have problem if have conflicting routes. there workaround makes work way well, it's bit of hack.

as long avoid having multiple routers trying handle same route should fine.

backbone.js router

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -