如何使用 AngularJS 或 JavaScript 解码 URL 参数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31488625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 13:53:41  来源:igfitidea点击:

How to decode URL parameter using AngularJS or JavaScript?

javascriptangularjs

提问by teddybear123

I have a value that I pass on to URL parameter the original value looks like this:

我有一个传递给 URL 参数的值,原始值如下所示:

1436641259169/nDfmDmVa

when it gets passed on it converts it to this:

当它被传递时,它会将其转换为:

1436641259169%252FnDfmDmVa

So, how to do I convert it back when I pull it down?

那么,当我下拉时如何将其转换回来?

回答by u283863

This may help you: decodeURIComponent

这可能会帮助您: decodeURIComponent

decodeURIComponent(string);

Example:

例子:

decodeURIComponent(decodeURIComponent("1436641259169%252FnDfmDmVa"))
> "1436641259169/nDfmDmVa"