Emberjs only redirect to default route if no subroute is specified

时间秒杀一切 提交于 2019-12-05 08:54:26

Implement redirect in DashboardIndexRoute instead of DashboardRoute.

App.DashboardIndexRoute = Ember.Route.extend({
  redirect: function() {
    return this.transitionTo('reach.demographics');
  }
});

I created a jsbin example for you. Try:

http://jsbin.com/odekus/6#/dashboard/

http://jsbin.com/odekus/6#/dashboard/traffic

I also removed unnecessary return's from the code.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!