1

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?

sly7_7
  • 11,961
  • 3
  • 40
  • 54
Charlie
  • 10,227
  • 10
  • 51
  • 92

1 Answers1

4

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
})
Bradley Priest
  • 7,438
  • 1
  • 29
  • 33