angular2路由器避免url编码

Has*_*san 10 javascript typescript angular

我是Angular 2的新手,并且不知道要搜索的正确术语以获得我需要的东西.

我在我的应用程序中使用Angular 2 RC5和RouterModule.当我将params传递给导航的路径时,Angular 2 Router会自动对其进行URL编码.现在虽然这是一件好事,但有没有办法阻止某些参数?

例如,我想在URL中添加逗号分隔值: http://localhost:4200/appcomponent/?data=abc1,abc2,abc3

什么角度2使它:( http://localhost:4200/appcomponent/;data=abc1%2Cabc2%2Cabc3看起来相当凌乱)

有关如何使其在URL中更具可读性的任何建议吗?

谢谢!

Ang*_*hub 12

您可以通过Url导航:

 router.navigateByUrl('/parent/11/(simple//right:user/victor)');
Run Code Online (Sandbox Code Playgroud)