0

I am new to Ember but I like it a lot. Currently, I am experiencing with the Router. However, I guess I don't really get it. This is the code I am using (taken from Emberjs's website):

App.Router = Ember.Router.extend({
      root: Ember.State.extend({
        index: Ember.State.extend({
          route: '/',
          redirectsTo: 'posts'
        }),
        posts: Ember.State.extend({
          route: '/posts'
        }),
        post: Ember.State.extend({
          route: '/posts/:post_id'
        })
      })
    });  

However, this code does nothing for me. Isn't it supposed to change the address to /posts when I hit the index? Am I doing something wrong? Thank you :)

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Andrew
  • 6,254
  • 16
  • 59
  • 93
  • take a look at http://stackoverflow.com/questions/11165315/ember-js-routing-how-do-you-set-a-default-route-to-render-immediately, you can find a working Router redirectsTo example in the accepted answer. – inancsevinc Aug 06 '12 at 13:39

1 Answers1

1

Use Ember.Route rather than Ember.State, since the routing-specific code was separated from Ember.StateManager / Ember.State.

dechov
  • 1,833
  • 1
  • 15
  • 18