Bookmarkable URLs with Routes Defined by Marionette Modules

Routes defined by our Marionette modules were not being loaded properly as a bookmarked URL.  I wasn’t sure why, but it was a simple mistake on our part.  The modules were being asynchronously loaded after the application started.

1. Ensure all modules are loaded before starting the Marionette Application.  In our case, we are using the dynamically loading require JS command.  I was calling each require statement separately, but I ended up creating an array of dependencies, then calling require on the entire array and using its callback to start the App.

App.router = new Router({
    controller: new Controller()
require(arrayOfModuleDependencies, function () {

2. Use the Marionette Application’s “start” event to call “Backbone.history.start();”  It looked like the initialization event happens before all the modules are started.

App.on('start', function () {


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s