URL中的角度和查询参数

问题描述 投票:0回答:1

如何在我的角度链接中添加查询参数。我尝试过这样的事情:

<a [routerLink]="['/?discounted=true']">Discounted</a>

但是它不起作用,因为它与任何路由器模式都不匹配我需要参数,以便可以以不同方式处理同一页面。

angular routing
1个回答
0
投票

您可以这样添加如果网址像{路径:“基本路径/折扣/:值”,组件:YourComponent,},然后使用

<a [routerLink]="['discounted', true ]">Discounted</a>
© www.soinside.com 2019 - 2024. All rights reserved.