Use $window.location.href instead of $location.url