7
我对Angular 2相当陌生,不知道为了得到我需要的正确搜索条件。angular2路由器避免url编码
我在我的应用程序中使用Angular 2 RC5和RouterModule。当我传递路径的参数以导航时,Angular 2 Router会自动对其进行URL编码。现在虽然这是一件好事,但是有没有办法阻止某些参数?
例如,我想在URL中添加逗号分隔值: http://localhost:4200/appcomponent/?data=abc1,abc2,abc3
什么角2使其: http://localhost:4200/appcomponent/;data=abc1%2Cabc2%2Cabc3
(这看起来相当凌乱)
任何建议如何使其更具可读性在URL中?
谢谢!
您可以指定确切的路由器库,你正在使用,并提供你的代码?谢谢! – wolendranh
我正在使用Angular 2的默认路由器库(@ angular/router:3.0.0-rc.1) 'let paramsObject = {data:'abc1,abc2,abc3'}; this.router.navigate(['/ appcomponent',paramsObject]);' – Hassan
查看我的答案以下类似的问题:http://stackoverflow.com/questions/41476193/angular-2-disable-url-encoding/ 41995695#41995695 –