Reputation: 618
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.
Upvotes: 1
Views: 74
Reputation: 222722
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';
Upvotes: 1