Use $location instead of $window.location