2

I want a certain route to immediately redirect to /50

index: Ember.Route.extend({
  route: '/',
  redirectsTo: '/50',
}),
post: Ember.Route.extend({
  route: '/:post_id',
  connectOutlets: function(router) {
  },
  deserialize: function() {
  }
})
4

1 に答える 1

2

Since redirectsTo basically is just 'translated' to the call router.transitionTo(redirection) inside connectOutlets (see routable.js), you can solve your issue in a similar way, see http://jsfiddle.net/pangratz666/DLYQK/:

App.Router = Ember.Router.extend({
    enableLogging: true,
    root: Ember.Route.extend({
        index: Ember.Route.extend({
            route: '/',
            connectOutlets: function(router) {
                router.route('/50');
            }
        }),
        post: Ember.Route.extend({
            route: '/:post_id'
        })
    })
});

App.initialize();
于 2012-06-23T12:42:49.147 に答える