URL编码破坏角度2导航 [英] URL Encoding breaking angular 2 navigation

查看:86
本文介绍了URL编码破坏角度2导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个以角度2开发的网站. 当我在chrome中为其提供可选参数时

I have a website developed in angular 2. When I provide optional parameters to it in chrome e.g.

https://aglplus-ui-demo.azurewebsites .net/home?error_code = 10000& transaction_id = 1543

这将转换为

https://aglplus-ui-demo.azure网站.net/home%3Ferror_code%3D10000%26transaction_id%3D1543

,并且无法在chrome中找到该页面.但是,当我在隐身模式下粘贴相同的网址时,它可以完美运行.我是新来的有角度的人,无法找到同样的原因.你能指导我正确的方向吗?

and is unable to find the page in chrome. However, when I paste the same url in incognito mode, it runs perfectly. I am new to angular and am unable to find a cause for the same. Could you please direct me to the right direction.

推荐答案

当我登录系统时发生了问题.有一个验证函数正在使用router.navigate()进行重定向.将其更改为router.navigateByUrl()可解决此问题.但是,我不确定为什么会这样.如果有人可以指导我,同样,我将非常有义务.

The issue was happening when I was logged in to the system. There was a validation function which was redirecting using router.navigate(). Changing that to router.navigateByUrl() fixed the issue. However, I am not sure why that is the case. If someone can guide me regarding the same, I will be very obliged.

这篇关于URL编码破坏角度2导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆