Ember.js 具有动态段名称的余烬路由

Ember.js 具有动态段名称的余烬路由,ember.js,ember-data,ember-cli,Ember.js,Ember Data,Ember Cli,我只是从Ember JS和Ember CLI开始,试图解决这个路由问题。我有一个团队模型,有很多游戏模型。通过以下途径,我可以从组URL显示游戏: Router.map(function() { this.resource("groups", function() { this.route('show', {path: ':group_id/show' }); }); }); 这将生成一个URL,其形式如下: http://localhost:4200/groups/1/sho

我只是从Ember JS和Ember CLI开始,试图解决这个路由问题。我有一个团队模型,有很多游戏模型。通过以下途径,我可以从组URL显示游戏:

Router.map(function() {
  this.resource("groups", function() {
    this.route('show', {path: ':group_id/show' });
  });
});
这将生成一个URL,其形式如下:

http://localhost:4200/groups/1/show
假设其中一个组名为“向导”。我希望能够以以下形式构建URL,并呈现属于“向导”的所有游戏:


任何提示都将不胜感激。

就像@blessenm在评论中指出的那样,您的路由器将从

Router.map(function() {
  this.resource("groups", function() {
    this.route('show', {path: ':group_id/show' });
  });
});


this.resource()
this.route()
的第二个参数是可选的。如果您没有传入任何内容,它将假定与您的路由/资源(在您的情况下为组)具有相同的名称。如果传入一个具有
路径:
键的对象,则指定路由的url,包括动态段。请参阅,以获取有关此的余烬文档

为什么不像这样添加一个新路由呢;在组资源中。
Router.map(function() {
  this.resource("groups", function() {
    this.route('show', {path: ':group_id/show' });
  });
});
Router.map(function() {
  this.resource("group", { path: ':group_name'});
});