0
votes

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 :)

1
take a look at stackoverflow.com/questions/11165315/…, you can find a working Router redirectsTo example in the accepted answer. - inancsevinc

1 Answers

1
votes

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