2017-01-01 57 views

回答

1

要求似乎很奇怪, 但要實現它,請嘗試使用自己的位置策略。 創建一個服務&,

export class MyPlatform extends LocationStrategy { 

prepareExternalUrl(internal:string):string{ 
//return whatever URL u want to return 
} 

} 

而在你app.module.ts 寫在供應商部分

providers:[ {provide:LocationStrategy,useClass:MyPlatform }] 
0

可以使用skipLocationChange指定一個布爾值爲truefalse

用法

// Navigate silently to /view 
this.router.navigate(['/view'], { skipLocationChange: true }); //as mentioned in the docs 

Here是它的一個拉動請求。

0

您可以提供(而不是默認PathLocationStrategy)自定義LocationStrategy實現,該實現不使用pushState API,只是在內部管理歷史記錄。