0

I am calling login, after successfull login, I would like to show dashboard screen.

But, dashboard page is not displaying after successful login. page is not refreshing, login page remains. No change.

Please help me to redirect to dashboard URL:

Angular JS Code

function loginctrl($scope, $http) {
$scope.login = function() {
    emp_url = '/login';
    emp_msg = "SUCCESSFULLY SIGN Up";

    $http.post(emp_url, $scope.formData).success(function(data) {                       
    });
};

}

Node.js Code

 app.get('/dashboard', isLoggedIn, function(req, res){  
    res.sendfile('./public/template-home.html', {user : req.user});     
});

app.post('/login', passport.authenticate('local-login', {
    successRedirect : '/dashboard', // redirect to the secure dashboard section
    failureRedirect : '/login', // redirect back to the signup page if there is an error
    failureFlash : true // allow flash messages
}));
Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64

1 Answers1

0

Answered here: Nodejs Redirect URL

Or you can use $location on the front end in the function you pass to .success

Angular docs for $location: https://docs.angularjs.org/api/ng/service/$location

Community
  • 1
  • 1
lwalden
  • 813
  • 7
  • 11