2017-09-17 42 views
-1

這是我的代碼:如何隱藏angular2中的路由ID和參數?

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

如何隱藏在瀏覽器的URL查詢參數重定向之後?

+0

使用可選參數,可以沿路由器主體發送,所以它不會被看到的網址 – Aravind

+0

熱這麼做?我對此毫不知情。 –

+0

[如何在使用核心angular2路由器的角度2應用程序中停止URL追加]可能的副本(https://stackoverflow.com/questions/39979552/how-to-stop-url-appending-in-angular-2-application- using-core-angular2-router) – Vega

回答

1

您可以使用skipLocationChange作爲將保留當前URL的參數。

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

http://prntscr.com/gm6d0a –

0

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

這解決了我的問題。