1


I am trying to redirect to another page on successful login, but instead of redirecting to another page, I am getting redirected to the default page which is:

.otherwise({
        redirectTo: '/home'
    })

`.

Angular code:

if(res.status == 200){
            console.log($scope.user);
            alert('Login successfull');
            $location.path('http://localhost:3000/#!/products/add-mew-product');
        }

Why this is happening, please help.

2
  • did you mean to redirect to add-mew-product ? or add-new-product Commented Dec 17, 2017 at 7:20
  • it's add-mew-product :) Commented Dec 17, 2017 at 7:21

1 Answer 1

1

You do not have to pass the whole url, instead of it pass as below

 $location.path('/products/add-mew-product');

or you can directly use

 $window.location.href = 'http://localhost:3000/#/products/add-mew-product';
Sign up to request clarification or add additional context in comments.

1 Comment

$window.location.href = 'http://localhost:3000/#!/products/add-mew-product';, is not working$location.path('/products/add-mew-product'); this working., Thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.