URI使用单独的参数进行解码

时间:2017-02-23 12:53:34

标签: angularjs

如何解析URI并分别显示参数enter image description here

检查附图。 任何参考都非常感谢。

2 个答案:

答案 0 :(得分:2)

您知道参数的名称吗?然后你可以这样做

http://www.angulartutorial.net/2015/04/get-url-parameter-using-angular-js.html

您要解码的网址,是当前访问过的网站还是用户在某个文本框中编写的网址?

然后这将是您的解决方案:https://stackoverflow.com/a/2880929/6629704 请注意,查询变量不应由window.location填充,而应由输入值

填充

答案 1 :(得分:0)

// Prints complete URL
document.write(window.location.href);

// Prints protocol like http: or https:
document.write(window.location.protocol); 

// Prints hostname with port like localhost or localhost:3000
document.write(window.location.host);

// Prints hostname like localhost or www.example.com
document.write(window.location.hostname);

// Prints port number like 3000
document.write(window.location.port);

// Prints pathname like /products/search.php
document.write(window.location.pathname); 

// Prints query string like ?q=ipad
document.write(window.location.search);

// Prints fragment identifier like #featured
document.write(window.location.hash);

来源:https://www.tutorialrepublic.com/javascript-tutorial/javascript-window-location.php