Passing Query Parameters

Use the [queryParams] directive along with [routerLink] to pass query parameters. For example:

<a [routerLink]=”[‘product-list’]” [queryParams]=”{ page: 99 }”>Go to Page 99</a>

 

Alternatively, we can navigate programmatically using the Router service:

goToPage(pageNum) {
this.router.navigate([‘/product-list’], { queryParams: { page: pageNum } });
}

 

发表评论

您的电子邮箱地址不会被公开。