Javascript 从服务器端重定向到url
我正在呼叫登录,成功登录后,我想显示仪表板屏幕 但是,仪表板页面在成功登录后不显示。页面未刷新,登录页面仍保留。没有变化 请帮助我重定向到仪表板URL: 角JS代码 } Node.js代码 答复如下: 或者,您可以在传递给的函数的前端使用$location。success $location的角度文档:将$location作为依赖项加载,并在成功处理程序中执行$location.url'/dashboard'。Javascript 从服务器端重定向到url,javascript,angularjs,node.js,Javascript,Angularjs,Node.js,我正在呼叫登录,成功登录后,我想显示仪表板屏幕 但是,仪表板页面在成功登录后不显示。页面未刷新,登录页面仍保留。没有变化 请帮助我重定向到仪表板URL: 角JS代码 } Node.js代码 答复如下: 或者,您可以在传递给的函数的前端使用$location。success $location的角度文档:将$location作为依赖项加载,并在成功处理程序中执行$location.url'/dashboard'。 function loginctrl($scope, $http) { $scope
function loginctrl($scope, $http) {
$scope.login = function() {
emp_url = '/login';
emp_msg = "SUCCESSFULLY SIGN Up";
$http.post(emp_url, $scope.formData).success(function(data) {
});
};
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
}));