1

I have this route part, /articles/. I would like to create subroutes here, like / and /list/. This is how I am trying:

articles: Ember.Route.extend({
    route: '/admin/articles',
    index: Ember.Route.extend({
        route: '/',
        connectOutlets: function (router, context) {
            "use strict";
            router.get('applicationController').connectOutlet('toolbar', 'articlesToolbar');
            router.get('applicationController').connectOutlet('main', 'articles');
        }
    }),
    list: Ember.Route.extend({
        route: '/list/',
        connectOutlets: function (router, context) {
            "use strict";
            router.get('applicationController').connectOutlet('toolbar', 'articlesToolbar');
            router.get('applicationController').connectOutlet('main', 'articles');
        }
    }),
    doLogout: function(router, context) {
        "use strict";
        router.transitionTo('login', context);
    }
}),

i must be doing something wrong, because it does not transition to the articles route. This is my routing log:

STATEMANAGER: Sending event 'doSidebar' to state root.
STATEMANAGER: Entering null
STATEMANAGER: Entering root
STATEMANAGER: Entering root.articles
STATEMANAGER: Sending event 'doSidebar' to state root.
STATEMANAGER: Entering null
STATEMANAGER: Entering root
STATEMANAGER: Entering root.media

But the articles url is not registered to the history -- if I click back, I get to the previous state, the one before articles.

What am I doing wrong?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Eduárd Moldován
  • 1,495
  • 3
  • 13
  • 29

2 Answers2

4

You cannot route to non-leaf states, so you cannot transition to 'articles'.
Either add initialState: 'index' to your articles route or change your code to transition to 'articles.index'

articles: Ember.Route.extend({
  route: '/admin/articles',
  initialState: 'index',
  index: Ember.Route.extend({
    //
Bradley Priest
  • 7,438
  • 1
  • 29
  • 33
0

You have no route defined for /articles. You need to change route: '/admin/articles' to route: '/articles' .

Nick Vanderbilt
  • 2,475
  • 3
  • 27
  • 33