I created PR #2363 which adds the possibility to specify the redirect
on an Ember.Route
as String
. Now that I think of it, it would be nice to specify this redirection without having to write a route.
So this
App.HomeRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo('teams');
}
});
would be specified in the router mapping
App.Router.map(function() {
this.route('home', { path: '/', redirect: 'teams' })
this.resource('teams', function() {
this.route('index', { redirect: 'favorites' });
this.route('favorites');
this.route('all');
});
});
What do you think?
Maybe this could be further simplified:
App.Router.map(function() {
this.route('home', { path: '/', redirect: 'teams' })
this.resource('teams', { index: 'favorites' }, function() {
this.route('favorites');
this.route('all');
});
});