My current url is http://localhost:4200/test/dashboard.
I want to print base url i.e http://localhost:4200 using angular 5 features.
No need for angular specific features, window.location.origin will do it for you.
window.location.origin
2.1m questions
2.1m answers
60 comments
57.0k users