如何将字符串查询传递给angular4中的params 获取此URL http://localhost:3000/reviews?business_id=KNpcPGqDORDdvtekXd348w
答案 0 :(得分:0)
你可以试试这个
import { ActivatedRoute, Router } from "@angular/router"
private router: Router, //the router variable should be added in the constructor
const route = "revews"
const params = {query: "superQuery"}
this.router.navigate([route, params])
答案 1 :(得分:0)
如果您想直接在html中执行此操作,请尝试以下操作:
<a [routerLink]="url" [queryParams]="param">link<\a>
其中,
url: string = '/reviews';
param: object = {
business_id: 'KNpcPGqDORDdvtekXd348w'
};