[英]Ember transition to route on parent dynamic segments (slugs)
我已經設置了當前的router.js
。
this.resource('parent', {path:'parent/:id'},function() {
this.route('child', {path:'child/:name'});
});
有效頁面是www.x.com/parent/5/child/jimmy
和www.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
的更新,同時保留了子級動態細分。
this.transitionToRoute('parent.child', '100', 'jimmy');
參見http://emberjs.com/api/classes/Ember.Controller.html#method_transitionToRoute
“最后將遞歸應用多個模型來首先建立資源樹。”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.