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

时间:2016-05-16 22:18:27

标签: ember.js

当前的信息中心网址是“报告/问卷调查”。用户经常会忘记输入完整的“/ report /问卷”,最后只需通过'/ reporting'进行搜索。

目前,这是一个嵌套路线。

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

是否有人熟悉如何将父路径'/ reporting'重定向到其嵌套子项'报告/问卷'?

1 个答案:

答案 0 :(得分:0)

想出来!用于Ember-CLI的EmberJS重定向插件:https://github.com/thoov/ember-redirect

这段代码就是:

var Router = Ember.Router.extend({
  location: config.locationType,

  redirects: {
    'reporting.index'  : 'reporting.questionnaires'
  }
});