2014-11-06 44 views
0

我打电话登录,成功登录后,我想显示仪表板屏幕。重定向到从服务器端的URL

但是,仪表板页面在成功登录后不显示。页面不刷新,登录页面保持不变。不用找了。

请帮我重定向到仪表板URL:

角JS代码

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的代码

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 
})); 
+0

负载'$ location'的依赖,并做'$位置.url('/ dashboard')'在成功处理程序中。 – 2014-11-06 15:31:30

回答