2017-01-01 45 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,只是在内部管理历史记录。