My current URL is http://localhost:4200/test/dashboard.
I want to print base URL i.e http://localhost:4200 using Angular 5 features.
console.log(location);
console.log(location.href);
to get base url : console.log(location.origin);
console.log(location.origin);