【问题标题】:Ember transition to route on parent dynamic segments (slugs)Ember 过渡到父动态段上的路由(段)
【发布时间】:2015-07-23 20:24:52
【问题描述】:

我设置了当前的router.js

this.resource('parent', {path:'parent/:id'},function() {
  this.route('child', {path:'child/:name'});
});

有效的页面是www.x.com/parent/5/child/jimmywww.x.com/parent/5

使用this.transitionToRoute('parent.child','jimmy'); 将转到此页面www.x.com/parent/5/child/jimmy

使用this.transitionToRoute('parent','5'); 将转到此页面www.x.com/parent/5

由于这条路由是嵌套的,:id参数对子路由有影响...

如何转换到www.x.com/parent/100/child/jimmy?这是父动态段:id 中的更新,同时保持子动态段。

【问题讨论】:

    标签: javascript ember.js routes transition


    【解决方案1】:
    this.transitionToRoute('parent.child', '100', 'jimmy');
    

    http://emberjs.com/api/classes/Ember.Controller.html#method_transitionToRoute

    “多个模型将在最后递归应用到资源树的第一个。”

    【讨论】:

      猜你喜欢
      • 2015-06-15
      • 1970-01-01
      • 1970-01-01
      • 2013-05-04
      • 2014-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多