ui-sref与params嵌套状态

时间:2016-05-24 13:02:33

标签: javascript angularjs angularjs-scope angular-ui-router mean-stack

.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

1 个答案:

答案 0 :(得分:4)

你几乎就在那里,先使用州名,然后用params传递对象{}

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