Hi I am using angularjs $location service. How can I get root of my url using this service. like if my current location is
http://localhost:8080/xyz#123
I want to extract out http://localhost:8080 or at least localhost:8080
var protocol = $location.protocol();
var host = $location.host();
var port = $location.port();
var combined = protocol + '://' + host + ':' + port;
$rootScope.If you want to do it using only $location, you can use
$location.host() + ":" + $location.port()