Reputation: 10307
Can anyone give a good example of how to break the router up into multiple files, and is there any best practise for doing this?
Upvotes: 1
Views: 367
Reputation: 7458
Here's a really simplified version of what I'm doing. Just make sure you require the files in the right order.
//router.js
App.Router = Ember.Router.extend({
accounts: App.AccountsRoutes.extend({
route: "/account"
})
// more routes here
})
//account_routes.js
App.AccountRoutes = Ember.Route.extend({
index: Ember.Route.extend({
route: '/',
connectOutlets: function(router){
// connect here
}
})
// more routes here
})
Upvotes: 4