AngularJS and satellizer - $location.path() not working

100 Views Asked by At

I'm using angular satellizer and this is my code.

login.js

MyApp.controller('LoginController', function($scope, $auth, $state, $location) {

    $scope.login = function() {

        var user = {
            email: $scope.email,
            password: $scope.password
        };

        $auth.login(user)
            .then(function(response) {
                // Redirect user here after a successful log in.
                $location.path('/');
                console.log("Success!"); 
            })
            .catch(function(response) {
                // Handle errors here, such as displaying a notification
                // for invalid email and/or password.
            });
    }
});

When I log in, I indeed see "Success!" in the console but I stay at the same page. More than that, if I use $state.go('dashboard', {}); it's working.

(PS. I read a bunch of posts about $location and couldn't come up with a solution)

0

There are 0 best solutions below