ui-sref 带参数的嵌套状态
ui-sref nested state with params
.state('user-profile', {
url: '/user-profile/:userId', //Parent state
...
.state('user-profile.profile',{ //nested
url:'/profile',
...
如何通过 ui-sref
"user-profile/123/profile"
访问 url
目前我正在尝试这个:
<a ui-sref="(user-profile({userId: currentUser._id})).profile">
这导致我 user-profile/123
你快到了,只需先使用state name,然后通过参数传递对象{}
:
//<a ui-sref="(user-profile({userId: currentUser._id})).profile">
<a ui-sref="user-profile.profile({userId: currentUser._id})">
.state('user-profile', {
url: '/user-profile/:userId', //Parent state
...
.state('user-profile.profile',{ //nested
url:'/profile',
...
如何通过 ui-sref
"user-profile/123/profile"
目前我正在尝试这个:
<a ui-sref="(user-profile({userId: currentUser._id})).profile">
这导致我 user-profile/123
你快到了,只需先使用state name,然后通过参数传递对象{}
:
//<a ui-sref="(user-profile({userId: currentUser._id})).profile">
<a ui-sref="user-profile.profile({userId: currentUser._id})">