EmberJS-将父路径重定向到嵌套的子路径



当前仪表板url为"报告/调查表"用户往往会忘记键入完整的"/报告/问卷",最终只搜索"/报告"。

此路由当前设置为嵌套路由。

Router.map(function() {
  this.route('reporting', function() {
    this.route('questionnaires');

熟悉如何将父路径"/reporting"重定向到嵌套的子路径"reporting/requestionary"的人吗?

想明白了!为Ember CLI使用了EmberJS重定向插件:https://github.com/thoov/ember-redirect

这个代码就是它所需要的:

var Router = Ember.Router.extend({
  location: config.locationType,
  redirects: {
    'reporting.index'  : 'reporting.questionnaires'
  }
});

最新更新