如何获取角度5中的基本网址? [英] How to get base url in angular 5?

查看:69
本文介绍了如何获取角度5中的基本网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的网址是 http://localhost:4200/test/dashboard .

我想使用5号角功能打印基本URL,即 http://localhost:4200 .

I want to print base url i.e http://localhost:4200 using angular 5 features.

推荐答案

console.log(location);

console.log(location);

console.log(location.href);

console.log(location.href);

获取基本网址:console.log(location.origin);

这篇关于如何获取角度5中的基本网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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