How to hide route id and params in angular2?

2019-09-21 16:23发布

问题:

This is my code:

<a [routerLink]="['/detailhistory']" [queryParams]="{ 'path': item.path}">{{ item.name }}</a>

how to hide query params in browser url after redirected?

回答1:

You can use skipLocationChange as a parameter which will keep the current URL.

<a [routerLink]="['/detailhistory']" [queryParams]="{ 'path': item.path}">{{ item.name }} [skipLocationChange]="true"</a>


回答2:

<a [routerLink]="['/detail' ]" [queryParams]="{ 'path': item.path}" skipLocationChange></i></a>

This solved my issue.



标签: angular