【AngularJS】拾遗 JavaScript
程序员文章站
2024-03-18 13:08:58
...
angular $location 库的使用,主要是获取url相关信息,例如
url = http://xxx.com?#name=cccccc
$location.absUrl();
// http://xxx.com?#name=cccccc
$location.host();
// xxx.com
$location.port();
// 80
$location.protocol();
// http
$location.url();
// ?#name=cccccc
// 获取url参数
$location.search().name;
// or
$location.search()['name'];
url = http://xxx.com?#name=cccccc
$location.absUrl();
// http://xxx.com?#name=cccccc
$location.host();
// xxx.com
$location.port();
// 80
$location.protocol();
// http
$location.url();
// ?#name=cccccc
// 获取url参数
$location.search().name;
// or
$location.search()['name'];