简体   繁体   English

带有参数的ui-sref嵌套状态

[英]ui-sref nested state with params

.state('user-profile', {
        url: '/user-profile/:userId', //Parent state
        ...
.state('user-profile.profile',{ //nested
        url:'/profile', 
        ...

How can I access the url via ui-sref "user-profile/123/profile" 我如何通过ui-sref “ user-profile / 123 / profile”访问URL

Currently I am trying this: 目前,我正在尝试:

<a ui-sref="(user-profile({userId: currentUser._id})).profile">

This leads me to user-profile/123 这导致我进入user-profile/123

You are almost there, just use state name first, and then pass object {} with params: 您快到了,只需先使用状态名称 ,然后使用params传递对象{}

//<a ui-sref="(user-profile({userId: currentUser._id})).profile">
<a ui-sref="user-profile.profile({userId: currentUser._id})">

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

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