diff options
author | Thomas Davis <thomasalwyndavis@gmail.com> | 2012-04-22 22:34:49 +1000 |
---|---|---|
committer | Thomas Davis <thomasalwyndavis@gmail.com> | 2012-04-22 22:34:49 +1000 |
commit | 8c649cecb0078addaf63a5e44f6a95eb930d15cc (patch) | |
tree | 142263d2e78addfbc88d7bbc363de919820c33d6 /examples/nodejs-mongodb-mongoose-restify/js/router.js | |
parent | e5f8494a4fb9ce62cf1cb7015451694c18ddf006 (diff) | |
download | backbonetutorials-8c649cecb0078addaf63a5e44f6a95eb930d15cc.zip backbonetutorials-8c649cecb0078addaf63a5e44f6a95eb930d15cc.tar.gz backbonetutorials-8c649cecb0078addaf63a5e44f6a95eb930d15cc.tar.bz2 |
blh
Diffstat (limited to 'examples/nodejs-mongodb-mongoose-restify/js/router.js')
-rw-r--r-- | examples/nodejs-mongodb-mongoose-restify/js/router.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/nodejs-mongodb-mongoose-restify/js/router.js b/examples/nodejs-mongodb-mongoose-restify/js/router.js new file mode 100644 index 0000000..2f65042 --- /dev/null +++ b/examples/nodejs-mongodb-mongoose-restify/js/router.js @@ -0,0 +1,29 @@ +// Filename: router.js +define([ + 'jquery', + 'underscore', + 'backbone', + 'vm' +], function ($, _, Backbone, Vm) { + var AppRouter = Backbone.Router.extend({ + routes: { + '*actions': 'defaultAction' // All urls will trigger this route + } + }); + + var initialize = function(options){ + var appView = options.appView; + var router = new AppRouter(options); + + router.on('route:defaultAction', function (actions) { + require(['views/dashboard/page'], function (DashboardPage) { + var dashboardPage = Vm.create(appView, 'DashboardPage', DashboardPage); + dashboardPage.render(); + }); + }); + + }; + return { + initialize: initialize + }; +}); |