简体   繁体   English

灰烬过渡到父级动态路段(段)上的路线

[英]Ember transition to route on parent dynamic segments (slugs)

I have this current router.js set up. 我已经设置了当前的router.js

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

Pages that are valid are www.x.com/parent/5/child/jimmy and www.x.com/parent/5 有效页面是www.x.com/parent/5/child/jimmywww.x.com/parent/5

Using this.transitionToRoute('parent.child','jimmy'); 使用this.transitionToRoute('parent.child','jimmy'); will get me to this page www.x.com/parent/5/child/jimmy . 将使我进入此页面www.x.com/parent/5/child/jimmy

Using this.transitionToRoute('parent','5'); 使用this.transitionToRoute('parent','5'); will get me to this page www.x.com/parent/5 . 将使我进入此页面www.x.com/parent/5

Since this route is nested, the :id parameter has an effect on the child route... 由于此路由是嵌套的,因此:id参数对子路由有影响...

How could I transition to www.x.com/parent/100/child/jimmy ? 我如何过渡到www.x.com/parent/100/child/jimmy This is an update in the parent's dynamic segment :id while maintaining child dynamic segments. 这是对父级动态细分:id的更新,同时保留了子级动态细分。

this.transitionToRoute('parent.child', '100', 'jimmy');

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

"Multiple models will be applied recursively last to first up the resource tree." “最后将递归应用多个模型来首先建立资源树。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM