如何在 ember 中找到子路由的参数?
How to find param of child route in ember?
假设我有 2 条路线,例如:
/users - shows list of users
-/:id - shows detail of selected user
给定上述路由的 url,/users
路由需要知道 /:id
参数,以便它可以在其列表中将用户显示为 'selected'。
然后如何在 /users
路线中获得 /:id
?
你可以使用paramsFor,在users route
你做this.paramsFor('route-name')
来获取给定路线的参数
假设我有 2 条路线,例如:
/users - shows list of users
-/:id - shows detail of selected user
给定上述路由的 url,/users
路由需要知道 /:id
参数,以便它可以在其列表中将用户显示为 'selected'。
然后如何在 /users
路线中获得 /:id
?
你可以使用paramsFor,在users route
你做this.paramsFor('route-name')
来获取给定路线的参数