gpt4 book ai didi

angularjs - 我需要将参数和查询传递到 ui-sref

转载 作者:行者123 更新时间:2023-12-02 23:34:49 26 4
gpt4 key购买 nike

我需要使用带有参数和查询参数的 ui-sref 动态构建指向 Angular 应用程序上另一条路线的链接。示例:

    <a class="clr-secondary" ui-sref="app.topic.individual.conversation.single
({cid:comment.activityItemId, cid:itemId})">{{comment.subject}}</a>

这会构造一个看起来像这样的链接

www.website.com/pass/11/conversations/178

我还需要在其末尾添加一个查询参数,以便整个网址看起来像

www.website.com/pass/11/conversations/178?comment_id=126

最佳答案

将查询参数添加到 ui 路由器配置中的 url 中:

.state('yourstate', {
url: '/pass/:activityId/conversations/:conversationId?comment_id',
templateUrl: 'path/to/template',
controller: 'YourController'
});

然后像传递其他参数一样传递 comment_id:

<a class="clr-secondary" ui-sref="app.topic.individual.conversation.single
({activityId:comment.activityItemId, conversationId:itemId, comment_id: 126})">{{comment.subject}}</a>

关于angularjs - 我需要将参数和查询传递到 ui-sref,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36720525/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com