Angular $rootScope and $window.location

The code below stores a login object in $rootScope, however when I retrieve it is undefined. There's a $window.location change afterwards, could that be the reason?

    var promise = ... $http request
    promise.then(
        function(response) {
            $rootScope.login = response.login;
            $window.location.href = 'main.html#/mngips';
        },
        function() { 
        }