use $window.location properly